diff options
author | Erik Andersen <andersen@codepoet.org> | 1999-12-28 00:17:46 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 1999-12-28 00:17:46 +0000 |
commit | 00266d3df6ba8dcc6247f112372a0ce5a8ab2c32 (patch) | |
tree | ca61fc301d4f1ee06b0a03bd352b672360b88eda | |
parent | 69ba6b2956202728a3da3489caa383fa6e7b114f (diff) | |
download | busybox-w32-00266d3df6ba8dcc6247f112372a0ce5a8ab2c32.tar.gz busybox-w32-00266d3df6ba8dcc6247f112372a0ce5a8ab2c32.tar.bz2 busybox-w32-00266d3df6ba8dcc6247f112372a0ce5a8ab2c32.zip |
Fixed a bug where tar would not set the user and group on device
special files.
-Erik
-rw-r--r-- | Changelog | 6 | ||||
-rw-r--r-- | archival/tar.c | 16 | ||||
-rw-r--r-- | tar.c | 16 |
3 files changed, 17 insertions, 21 deletions
@@ -10,9 +10,9 @@ | |||
10 | * Added 'grep -q' thanks to a patch from "Konstantin Boldyshev" | 10 | * Added 'grep -q' thanks to a patch from "Konstantin Boldyshev" |
11 | <konst@voshod.com>. | 11 | <konst@voshod.com>. |
12 | * Implemented sort. -beppu | 12 | * Implemented sort. -beppu |
13 | * Fixed tar SGID and SUID bug. Seems that chown(2) clears S_ISUID and | 13 | * Fixed a bug where tar would set, and then clear SGID and SUID bits. |
14 | S_ISGID, even when chown is called as root. I changed the ordering | 14 | * Fixed a bug where tar would not set the user and group on device |
15 | of chown and chmod so SGID and SUID file permissions don't get munged. | 15 | special files. |
16 | 16 | ||
17 | -Erik Andersen | 17 | -Erik Andersen |
18 | 18 | ||
diff --git a/archival/tar.c b/archival/tar.c index bff248212..7167d95cd 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -577,17 +577,15 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
577 | } else { | 577 | } else { |
578 | outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); | 578 | outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); |
579 | } | 579 | } |
580 | if (outFd < 0) { | ||
581 | perror (name); | ||
582 | skipFileFlag = TRUE; | ||
583 | return; | ||
584 | } | ||
585 | chown(name, uid, gid); | ||
586 | chmod(name, mode); | ||
580 | } | 587 | } |
581 | 588 | ||
582 | if (outFd < 0) { | ||
583 | perror (name); | ||
584 | skipFileFlag = TRUE; | ||
585 | return; | ||
586 | } | ||
587 | if (tostdoutFlag == FALSE) { | ||
588 | fchown(outFd, uid, gid); | ||
589 | fchmod(outFd, mode); | ||
590 | } | ||
591 | 589 | ||
592 | /* | 590 | /* |
593 | * If the file is empty, then that's all we need to do. | 591 | * If the file is empty, then that's all we need to do. |
@@ -577,17 +577,15 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable) | |||
577 | } else { | 577 | } else { |
578 | outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); | 578 | outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); |
579 | } | 579 | } |
580 | if (outFd < 0) { | ||
581 | perror (name); | ||
582 | skipFileFlag = TRUE; | ||
583 | return; | ||
584 | } | ||
585 | chown(name, uid, gid); | ||
586 | chmod(name, mode); | ||
580 | } | 587 | } |
581 | 588 | ||
582 | if (outFd < 0) { | ||
583 | perror (name); | ||
584 | skipFileFlag = TRUE; | ||
585 | return; | ||
586 | } | ||
587 | if (tostdoutFlag == FALSE) { | ||
588 | fchown(outFd, uid, gid); | ||
589 | fchmod(outFd, mode); | ||
590 | } | ||
591 | 589 | ||
592 | /* | 590 | /* |
593 | * If the file is empty, then that's all we need to do. | 591 | * If the file is empty, then that's all we need to do. |