summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-13 08:09:07 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2009-11-13 08:09:07 (GMT)
commit5799248976c1227663c4c9b7758e64dee3d5185b (patch)
tree5cfdd50b3937efec6142f1e88e82d155f28e834b
parent6331cf059ccfdf35f4e5a505cbae885094cc41b0 (diff)
downloadbusybox-5799248976c1227663c4c9b7758e64dee3d5185b.tar.gz
busybox-5799248976c1227663c4c9b7758e64dee3d5185b.tar.bz2
sed: on output file, set not only mode, but owner too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/sed.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/editors/sed.c b/editors/sed.c
index cc609c3..c1ee750 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -1340,10 +1340,10 @@ int sed_main(int argc UNUSED_PARAM, char **argv)
bb_perror_msg_and_die("can't create temp file %s", G.outname);
G.nonstdout = fdopen(nonstdoutfd, "w");
- /* Set permissions of output file */
-
+ /* Set permissions/owner of output file */
fstat(fileno(file), &statbuf);
fchmod(nonstdoutfd, statbuf.st_mode);
+ fchown(nonstdoutfd, statbuf.st_uid, statbuf.st_gid);
add_input_file(file);
process_files();
fclose(G.nonstdout);