aboutsummaryrefslogtreecommitdiff
path: root/tar.c
diff options
context:
space:
mode:
authorerik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-12-27 23:48:33 +0000
committererik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>1999-12-27 23:48:33 +0000
commit7a09b4d6573cd0df294f92c924672229cd72251f (patch)
tree5ddf65224b19b141783561b13a7c0dc35b6dda12 /tar.c
parentb2f2a8d3eca662dfbb5de1e9a0c198751f3c2089 (diff)
downloadbusybox-w32-7a09b4d6573cd0df294f92c924672229cd72251f.tar.gz
busybox-w32-7a09b4d6573cd0df294f92c924672229cd72251f.tar.bz2
busybox-w32-7a09b4d6573cd0df294f92c924672229cd72251f.zip
chown(2) clears S_ISUID and S_ISGID, even when chown is
called as root. Changed ordering of chown and chmod so SGID and SUID file permissions don't get munged. -Erik git-svn-id: svn://busybox.net/trunk/busybox@263 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'tar.c')
-rw-r--r--tar.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tar.c b/tar.c
index 438770c03..bff248212 100644
--- a/tar.c
+++ b/tar.c
@@ -520,8 +520,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
520 if (hardLink) { 520 if (hardLink) {
521 if (link (hp->linkName, name) < 0) 521 if (link (hp->linkName, name) < 0)
522 perror (name); 522 perror (name);
523 chmod(name, mode);
524 chown(name, uid, gid); 523 chown(name, uid, gid);
524 chmod(name, mode);
525 return; 525 return;
526 } 526 }
527 527
@@ -529,8 +529,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
529#ifdef S_ISLNK 529#ifdef S_ISLNK
530 if (symlink (hp->linkName, name) < 0) 530 if (symlink (hp->linkName, name) < 0)
531 perror (name); 531 perror (name);
532 chmod(name, mode);
533 chown(name, uid, gid); 532 chown(name, uid, gid);
533 chmod(name, mode);
534#else 534#else
535 fprintf (stderr, "Cannot create symbolic links\n"); 535 fprintf (stderr, "Cannot create symbolic links\n");
536#endif 536#endif
@@ -546,8 +546,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
546 */ 546 */
547 if (S_ISDIR (mode)) { 547 if (S_ISDIR (mode)) {
548 createPath (name, mode); 548 createPath (name, mode);
549 chmod(name, mode);
550 chown(name, uid, gid); 549 chown(name, uid, gid);
550 chmod(name, mode);
551 551
552 return; 552 return;
553 } 553 }
@@ -585,8 +585,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
585 return; 585 return;
586 } 586 }
587 if (tostdoutFlag == FALSE) { 587 if (tostdoutFlag == FALSE) {
588 fchmod(outFd, mode);
589 fchown(outFd, uid, gid); 588 fchown(outFd, uid, gid);
589 fchmod(outFd, mode);
590 } 590 }
591 591
592 /* 592 /*