[hackers] [sbase] Fix two more instances where the check for "-" is insufficient || sin

From: <git_AT_suckless.org>
Date: Tue, 18 Nov 2014 22:58:54 +0100

commit 4399f354486612c679a343c7f9e1ff18df857098
Author: sin <sin_AT_2f30.org>
Date: Tue Nov 18 21:57:54 2014 +0000

    Fix two more instances where the check for "-" is insufficient

diff --git a/cmp.c b/cmp.c
index c9d38f3..976bc00 100644
--- a/cmp.c
+++ b/cmp.c
_AT_@ -37,7 +37,7 @@ main(int argc, char *argv[])
         if (argc != 2)
                 usage();
 
- if (argv[0][0] == '-')
+ if (argv[0][0] == '-' && !argv[0][1])
                 argv[0] = "/dev/fd/0";
         fp[0] = fopen(argv[0], "r");
         if (!fp[0]) {
_AT_@ -46,7 +46,7 @@ main(int argc, char *argv[])
                 exit(Error);
         }
 
- if (argv[1][0] == '-')
+ if (argv[1][0] == '-' && !argv[1][1])
                 argv[1] = "/dev/fd/0";
         fp[1] = fopen(argv[1], "r");
         if (!fp[1]) {
diff --git a/comm.c b/comm.c
index 59cfc3d..a946cba 100644
--- a/comm.c
+++ b/comm.c
_AT_@ -41,7 +41,7 @@ main(int argc, char *argv[])
                 usage();
 
         for (i = 0; i < LEN(fp); i++) {
- if (argv[i][0] == '-')
+ if (argv[i][0] == '-' && !argv[i][1])
                         argv[i] = "/dev/fd/0";
                 if (!(fp[i] = fopen(argv[i], "r")))
                         eprintf("fopen %s:", argv[i]);
Received on Tue Nov 18 2014 - 22:58:54 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 18 2014 - 23:00:23 CET