Skip to content

Commit d796940

Browse files
hhoffstaettetwaugh
authored andcommitted
Use redirectfd() in filterdiff (#91)
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
1 parent 2bf9f25 commit d796940

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

‎src/filterdiff.c‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,15 +1828,10 @@ int main (int argc, char *argv[])
18281828

18291829
if (inplace_mode) {
18301830
/* Redirect stdout to temporary file for in-place processing */
1831-
FILE *temp_output = xtmpfile();
1832-
FILE *old_stdout = stdout;
1833-
stdout = temp_output;
1831+
FILE *temp_output = redirectfd(stdout);
18341832

18351833
filterdiff (f, argv[i]);
18361834

1837-
/* Restore stdout */
1838-
stdout = old_stdout;
1839-
18401835
/* Write temp file contents back to original file */
18411836
if (write_file_inplace(argv[i], temp_output) != 0) {
18421837
error (EXIT_FAILURE, errno, "failed to write %s", argv[i]);

0 commit comments

Comments
 (0)