sed: on output file, set not only mode, but owner too
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
6331cf059c
commit
5799248976
@ -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);
|
bb_perror_msg_and_die("can't create temp file %s", G.outname);
|
||||||
G.nonstdout = fdopen(nonstdoutfd, "w");
|
G.nonstdout = fdopen(nonstdoutfd, "w");
|
||||||
|
|
||||||
/* Set permissions of output file */
|
/* Set permissions/owner of output file */
|
||||||
|
|
||||||
fstat(fileno(file), &statbuf);
|
fstat(fileno(file), &statbuf);
|
||||||
fchmod(nonstdoutfd, statbuf.st_mode);
|
fchmod(nonstdoutfd, statbuf.st_mode);
|
||||||
|
fchown(nonstdoutfd, statbuf.st_uid, statbuf.st_gid);
|
||||||
add_input_file(file);
|
add_input_file(file);
|
||||||
process_files();
|
process_files();
|
||||||
fclose(G.nonstdout);
|
fclose(G.nonstdout);
|
||||||
|
Loading…
Reference in New Issue
Block a user