commit: d62043990191a52e74c6a4e7d285204b9cf3797b
parent e715848e1690e4dcce087ee12f9e8a4de9d1a961
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Thu, 24 Jul 2025 21:26:15 +0200
cmd/paste: handle fclose error in sequential mode
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/cmd/paste.c b/cmd/paste.c
@@ -203,7 +203,14 @@ sequential(char **argv)
needdelim = 1;
}
if(needdelim) putwchar(linedelim);
- if(fp != stdin) (void)fclose(fp);
+ if(fp != stdin)
+ {
+ if(fclose(fp) != 0)
+ {
+ fprintf(stderr, "%s: error: Failed closing file '%s': %s\n", argv0, p, strerror(errno));
+ failed = 1;
+ }
+ }
}
return (failed != 0);