aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/lib.c b/lib/lib.c
index fe85cbed..c20a06cf 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -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;
}