Browse code

improve target detection in --verify-cdiff

git-svn: trunk@2186

Tomasz Kojm authored on 2006/08/11 22:50:34
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Fri Aug 11 15:49:24 CEST 2006 (tk)
2
+----------------------------------
3
+  * sigtool/sigtool.c: improve target detection in --verify-cdiff
4
+
1 5
 Wed Aug  9 14:09:34 CEST 2006 (tk)
2 6
 ----------------------------------
3 7
   * sigtool/sigtool.c: --list-sigs now supports incremental directories
... ...
@@ -1476,6 +1476,7 @@ int main(int argc, char **argv)
1476 1476
 {
1477 1477
 	int ret = 1;
1478 1478
         struct optstruct *opt;
1479
+	struct stat sb;
1479 1480
 	const char *short_options = "hvVb:i:u:l::r:d:";
1480 1481
 	static struct option long_options[] = {
1481 1482
 	    {"help", 0, 0, 'h'},
... ...
@@ -1556,10 +1557,15 @@ int main(int argc, char **argv)
1556 1556
 	    mprintf("!--verify-cdiff requires two arguments\n");
1557 1557
 	    ret = -1;
1558 1558
 	} else {
1559
-	    if(cli_strbcasestr(opt->filename, ".cvd"))
1560
-		ret = verifycdiff(opt_arg(opt, "verify-cdiff"), opt->filename, NULL);
1561
-	    else
1562
-		ret = verifycdiff(opt_arg(opt, "verify-cdiff"), NULL, opt->filename);
1559
+	    if(stat(opt->filename, &sb) == -1) {
1560
+		mprintf("--verify-cdiff: Can't get status of %s\n", opt->filename);
1561
+		ret = -1;
1562
+	    } else {
1563
+		if(S_ISDIR(sb.st_mode))
1564
+		    ret = verifycdiff(opt_arg(opt, "verify-cdiff"), NULL, opt->filename);
1565
+		else
1566
+		    ret = verifycdiff(opt_arg(opt, "verify-cdiff"), opt->filename, NULL);
1567
+	    }
1563 1568
 	}
1564 1569
     } else
1565 1570
 	help();