diff options
author | Erik Andersen <andersen@codepoet.org> | 1999-12-27 23:48:33 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 1999-12-27 23:48:33 +0000 |
commit | 98f67e35d82e19f7a5e58551b5dd8feb121229b9 (patch) | |
tree | 5ddf65224b19b141783561b13a7c0dc35b6dda12 /tar.c | |
parent | 00417a38c10f1f5685013d16ad4fb782aa2deddb (diff) | |
download | busybox-w32-98f67e35d82e19f7a5e58551b5dd8feb121229b9.tar.gz busybox-w32-98f67e35d82e19f7a5e58551b5dd8feb121229b9.tar.bz2 busybox-w32-98f67e35d82e19f7a5e58551b5dd8feb121229b9.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
Diffstat (limited to 'tar.c')
-rw-r--r-- | tar.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 | /* |