Fixed a bug where tar would not set the user and group on device
special files. -Erik
This commit is contained in:
parent
69ba6b2956
commit
00266d3df6
@ -10,9 +10,9 @@
|
|||||||
* Added 'grep -q' thanks to a patch from "Konstantin Boldyshev"
|
* Added 'grep -q' thanks to a patch from "Konstantin Boldyshev"
|
||||||
<konst@voshod.com>.
|
<konst@voshod.com>.
|
||||||
* Implemented sort. -beppu
|
* Implemented sort. -beppu
|
||||||
* Fixed tar SGID and SUID bug. Seems that chown(2) clears S_ISUID and
|
* Fixed a bug where tar would set, and then clear SGID and SUID bits.
|
||||||
S_ISGID, even when chown is called as root. I changed the ordering
|
* Fixed a bug where tar would not set the user and group on device
|
||||||
of chown and chmod so SGID and SUID file permissions don't get munged.
|
special files.
|
||||||
|
|
||||||
-Erik Andersen
|
-Erik Andersen
|
||||||
|
|
||||||
|
@ -577,18 +577,16 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
|
|||||||
} else {
|
} else {
|
||||||
outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (outFd < 0) {
|
if (outFd < 0) {
|
||||||
perror (name);
|
perror (name);
|
||||||
skipFileFlag = TRUE;
|
skipFileFlag = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tostdoutFlag == FALSE) {
|
chown(name, uid, gid);
|
||||||
fchown(outFd, uid, gid);
|
chmod(name, mode);
|
||||||
fchmod(outFd, mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the file is empty, then that's all we need to do.
|
* If the file is empty, then that's all we need to do.
|
||||||
*/
|
*/
|
||||||
|
8
tar.c
8
tar.c
@ -577,18 +577,16 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
|
|||||||
} else {
|
} else {
|
||||||
outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (outFd < 0) {
|
if (outFd < 0) {
|
||||||
perror (name);
|
perror (name);
|
||||||
skipFileFlag = TRUE;
|
skipFileFlag = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (tostdoutFlag == FALSE) {
|
chown(name, uid, gid);
|
||||||
fchown(outFd, uid, gid);
|
chmod(name, mode);
|
||||||
fchmod(outFd, mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the file is empty, then that's all we need to do.
|
* If the file is empty, then that's all we need to do.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user