diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/lib.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -640,11 +640,15 @@ int copy_tempfile(int fdin, char *name, char **tempname) if (!tempfile2zap) sigatexit(tempfile_handler); tempfile2zap = *tempname; - // Set permissions of output file + // Set permissions of output file (ignoring errors, usually due to nonroot) fstat(fdin, &statbuf); fchmod(fd, statbuf.st_mode); + // It's fine if this fails (generally because we're not root), but gcc no + // longer lets a (void) typecast silence the "unused result" warning, so... + if (fchown(fd, statbuf.st_uid, statbuf.st_gid)); + return fd; } |