1 parent 2bf9f25 commit d796940Copy full SHA for d796940
1 file changed
src/filterdiff.c
@@ -1828,15 +1828,10 @@ int main (int argc, char *argv[])
1828
1829
if (inplace_mode) {
1830
/* Redirect stdout to temporary file for in-place processing */
1831
- FILE *temp_output = xtmpfile();
1832
- FILE *old_stdout = stdout;
1833
- stdout = temp_output;
+ FILE *temp_output = redirectfd(stdout);
1834
1835
filterdiff (f, argv[i]);
1836
1837
- /* Restore stdout */
1838
- stdout = old_stdout;
1839
-
1840
/* Write temp file contents back to original file */
1841
if (write_file_inplace(argv[i], temp_output) != 0) {
1842
error (EXIT_FAILURE, errno, "failed to write %s", argv[i]);
0 commit comments