This sed patch can only be described as "duh". Stat the source file, chmod
authorEric Andersen <andersen@codepoet.org>
Wed, 21 Apr 2004 00:57:14 +0000 (00:57 -0000)
committerEric Andersen <andersen@codepoet.org>
Wed, 21 Apr 2004 00:57:14 +0000 (00:57 -0000)
the _destination_ file.  (Ah hah!  That works _much_ better...)  I
implemented the behavior, I just forgot to test this corner of it.  My fault,
sorry...

No, gnu sed -i doesn't preverve ownership information.  I checked.
Permissions, yes, ownership info, no.

Rob

editors/sed.c

index 968d0d2a28e0259c6b8a59e63f2cec2a989d637f..750f41acd5f8480a0ad2d3d7f5ffaded805d9a66 100644 (file)
@@ -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);