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

39 lines
868 B
Plaintext
Raw Normal View History

--- src/file.c
+++ src/file.c 2009-05-05 12:05:15.000000000 +0000
@@ -195,6 +195,8 @@ main(int argc, char *argv[])
flags |= MAGIC_DEBUG|MAGIC_CHECK;
break;
case 'e':
+ if (!optarg)
+ usage();
for (i = 0; i < sizeof(nv) / sizeof(nv[0]); i++)
if (strcmp(nv[i].name, optarg) == 0)
break;
@@ -206,7 +208,7 @@ main(int argc, char *argv[])
break;
case 'f':
- if(action)
+ if(action || !optarg)
usage();
if (magic == NULL)
if ((magic = load(magicfile, flags)) == NULL)
@@ -215,6 +217,8 @@ main(int argc, char *argv[])
++didsomefiles;
break;
case 'F':
+ if (!optarg)
+ usage();
separator = optarg;
break;
case 'i':
@@ -227,6 +231,8 @@ main(int argc, char *argv[])
action = FILE_LIST;
break;
case 'm':
+ if (!optarg)
+ usage();
magicfile = optarg;
break;
case 'n':