add a comment about sed and suid bits
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 18 Jun 2010 00:12:56 +0000 (02:12 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 18 Jun 2010 00:12:56 +0000 (02:12 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
editors/sed.c

index a5ef400fcebddebcd026a2a113e7c9e01bd9b244..28f0c7318ce9fc8d9b784b16e6c7e601b459530b 100644 (file)
@@ -1365,6 +1365,8 @@ int sed_main(int argc UNUSED_PARAM, char **argv)
 
                        /* Set permissions/owner of output file */
                        fstat(fileno(file), &statbuf);
+                       /* chmod'ing AFTER chown would preserve suid/sgid bits,
+                        * but GNU sed 4.2.1 does not preserve them either */
                        fchmod(nonstdoutfd, statbuf.st_mode);
                        fchown(nonstdoutfd, statbuf.st_uid, statbuf.st_gid);
                        add_input_file(file);