Browse code

fix arg handling in vbadump() (bb#857)

git-svn: trunk@3665

Tomasz Kojm authored on 2008/02/22 00:22:36
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Feb 21 15:22:04 CET 2008 (tk)
2
+---------------------------------
3
+  * sigtool/sigtool.c: fix arg handling in vbadump() (bb#857)
4
+
1 5
 Thu Feb 21 09:42:33 GMT 2008 (njh)
2 6
 ----------------------------------
3 7
   * clamav-milter:	Fix a bug in IPv4 local addresses added by the patch
... ...
@@ -1167,18 +1167,22 @@ static int listsigs(struct optstruct *opt)
1167 1167
 
1168 1168
 static int vbadump(struct optstruct *opt)
1169 1169
 {
1170
-	int fd, hex_output=0;
1170
+	int fd, hex_output;
1171 1171
 	char *dir;
1172
+	const char *pt;
1172 1173
 
1173 1174
 
1174
-    if(opt_check(opt, "vba-hex"))
1175
+    if(opt_check(opt, "vba-hex")) {
1175 1176
 	hex_output = 1;
1177
+	pt = opt_arg(opt, "vba-hex");
1178
+    } else {
1179
+	hex_output = 0;
1180
+	pt = opt_arg(opt, "vba");
1181
+    }
1176 1182
  
1177
-    if((fd = open(opt_arg(opt, "vba"), O_RDONLY)) == -1) {
1178
-	if((fd = open(opt_arg(opt, "vba-hex"), O_RDONLY)) == -1) {
1179
-	    mprintf("!vbadump: Can't open file %s\n", opt_arg(opt, "vba"));
1180
-	    return -1;
1181
-	}
1183
+    if((fd = open(pt, O_RDONLY)) == -1) {
1184
+	mprintf("!vbadump: Can't open file %s\n", pt);
1185
+	return -1;
1182 1186
     }
1183 1187
 
1184 1188
     /* generate the temporary directory */