Fix two more instances where the check for "-" is insufficient
This commit is contained in:
parent
148e6e3b79
commit
4399f35448
4
cmp.c
4
cmp.c
|
@ -37,7 +37,7 @@ main(int argc, char *argv[])
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
if (argv[0][0] == '-')
|
if (argv[0][0] == '-' && !argv[0][1])
|
||||||
argv[0] = "/dev/fd/0";
|
argv[0] = "/dev/fd/0";
|
||||||
fp[0] = fopen(argv[0], "r");
|
fp[0] = fopen(argv[0], "r");
|
||||||
if (!fp[0]) {
|
if (!fp[0]) {
|
||||||
|
@ -46,7 +46,7 @@ main(int argc, char *argv[])
|
||||||
exit(Error);
|
exit(Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argv[1][0] == '-')
|
if (argv[1][0] == '-' && !argv[1][1])
|
||||||
argv[1] = "/dev/fd/0";
|
argv[1] = "/dev/fd/0";
|
||||||
fp[1] = fopen(argv[1], "r");
|
fp[1] = fopen(argv[1], "r");
|
||||||
if (!fp[1]) {
|
if (!fp[1]) {
|
||||||
|
|
2
comm.c
2
comm.c
|
@ -41,7 +41,7 @@ main(int argc, char *argv[])
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
for (i = 0; i < LEN(fp); i++) {
|
for (i = 0; i < LEN(fp); i++) {
|
||||||
if (argv[i][0] == '-')
|
if (argv[i][0] == '-' && !argv[i][1])
|
||||||
argv[i] = "/dev/fd/0";
|
argv[i] = "/dev/fd/0";
|
||||||
if (!(fp[i] = fopen(argv[i], "r")))
|
if (!(fp[i] = fopen(argv[i], "r")))
|
||||||
eprintf("fopen %s:", argv[i]);
|
eprintf("fopen %s:", argv[i]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user