called as root. Changed ordering of chown and chmod so
SGID and SUID file permissions don't get munged.
-Erik
if (hardLink) {
if (link (hp->linkName, name) < 0)
perror (name);
- chmod(name, mode);
chown(name, uid, gid);
+ chmod(name, mode);
return;
}
#ifdef S_ISLNK
if (symlink (hp->linkName, name) < 0)
perror (name);
- chmod(name, mode);
chown(name, uid, gid);
+ chmod(name, mode);
#else
fprintf (stderr, "Cannot create symbolic links\n");
#endif
*/
if (S_ISDIR (mode)) {
createPath (name, mode);
- chmod(name, mode);
chown(name, uid, gid);
+ chmod(name, mode);
return;
}
return;
}
if (tostdoutFlag == FALSE) {
- fchmod(outFd, mode);
fchown(outFd, uid, gid);
+ fchmod(outFd, mode);
}
/*
if (hardLink) {
if (link (hp->linkName, name) < 0)
perror (name);
- chmod(name, mode);
chown(name, uid, gid);
+ chmod(name, mode);
return;
}
#ifdef S_ISLNK
if (symlink (hp->linkName, name) < 0)
perror (name);
- chmod(name, mode);
chown(name, uid, gid);
+ chmod(name, mode);
#else
fprintf (stderr, "Cannot create symbolic links\n");
#endif
*/
if (S_ISDIR (mode)) {
createPath (name, mode);
- chmod(name, mode);
chown(name, uid, gid);
+ chmod(name, mode);
return;
}
return;
}
if (tostdoutFlag == FALSE) {
- fchmod(outFd, mode);
fchown(outFd, uid, gid);
+ fchmod(outFd, mode);
}
/*