paste: No need to make an exception for stdin, just close it at the end
This commit is contained in:
parent
1c6298103e
commit
0779d69df7
8
paste.c
8
paste.c
|
@ -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];
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user