diff --git a/editors/sed.c b/editors/sed.c index 968d0d2a2..750f41acd 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -1191,7 +1191,7 @@ extern int sed_main(int argc, char **argv) nonstdout=bb_wfopen(outname,"w"); /* Set permissions of output file */ fstat(fileno(file),&statbuf); - fchmod(fileno(file),statbuf.st_mode); + fchmod(fileno(nonstdout),statbuf.st_mode); atexit(cleanup_outname); } process_file(file);