[hackers] [sbase] paste: No need to make an exception for stdin, just close it at the end || sin
commit 0779d69df77f3f05c1df1da13b6e4705a1af1288
Author: sin <sin_AT_2f30.org>
Date: Tue Feb 10 12:08:06 2015 +0000
paste: No need to make an exception for stdin, just close it at the end
diff --git a/paste.c b/paste.c
index 1da8c31..fd8ca77 100644
--- a/paste.c
+++ b/paste.c
_AT_@ -120,10 +120,8 @@ main(int argc, char *argv[])
dsc[i].fp = stdin;
else
dsc[i].fp = fopen(argv[i], "r");
-
if (!dsc[i].fp)
eprintf("fopen %s:", argv[i]);
-
dsc[i].name = argv[i];
}
_AT_@ -132,10 +130,8 @@ main(int argc, char *argv[])
else
parallel(dsc, argc, delim, len);
- for (i = 0; i < argc; i++) {
- if (dsc[i].fp != stdin)
- (void)fclose(dsc[i].fp);
- }
+ for (i = 0; i < argc; i++)
+ fclose(dsc[i].fp);
return 0;
}
Received on Tue Mar 24 2015 - 23:53:40 CET
This archive was generated by hypermail 2.3.0
: Wed Mar 25 2015 - 00:09:06 CET