SHA256
1
0
forked from pool/file
file/file-5.17-option.dif

43 lines
927 B
Plaintext

---
src/file.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- src/file.c
+++ src/file.c 2019-05-27 08:48:39.047051545 +0000
@@ -242,6 +242,8 @@ main(int argc, char *argv[])
flags |= MAGIC_ERROR;
break;
case 'e':
+ if (!optarg)
+ usage();
for (i = 0; i < __arraycount(nv); i++)
if (strcmp(nv[i].name, optarg) == 0)
break;
@@ -253,7 +255,7 @@ main(int argc, char *argv[])
break;
case 'f':
- if(action)
+ if(action || !optarg)
usage();
if (magic == NULL)
if ((magic = load(magicfile, flags)) == NULL)
@@ -263,6 +265,8 @@ main(int argc, char *argv[])
++didsomefiles;
break;
case 'F':
+ if (!optarg)
+ usage();
separator = optarg;
break;
case 'i':
@@ -275,6 +279,8 @@ main(int argc, char *argv[])
action = FILE_LIST;
break;
case 'm':
+ if (!optarg)
+ usage();
magicfile = optarg;
break;
case 'n':