Browse code

Return code tweaks for bb#5252

David Raynor authored on 2012/06/30 03:25:38
Showing 1 changed files
... ...
@@ -2538,10 +2538,16 @@ static int magic_scandesc(cli_ctx *ctx, cli_file_t type)
2538 2538
 	res = cli_scanraw(ctx, type, typercg, &dettype, hash);
2539 2539
 	if(res != CL_CLEAN) {
2540 2540
 	    switch(res) {
2541
-		/* Short list of scan halts, major runtime errors only! */
2542
-		case CL_EREAD:
2541
+		/* List of scan halts, runtime errors only! */
2542
+		case CL_EUNLINK:
2543
+		case CL_ESTAT:
2543 2544
 		case CL_ESEEK:
2545
+		case CL_EWRITE:
2546
+		case CL_EDUP:
2547
+		case CL_ETMPFILE:
2548
+		case CL_ETMPDIR:
2544 2549
 		case CL_EMEM:
2550
+		case CL_ETIMEOUT:
2545 2551
 		    cli_dbgmsg("Descriptor[%d]: cli_scanraw error %s\n", fmap_fd(*ctx->fmap), cl_strerror(res));
2546 2552
 		    cli_bitset_free(ctx->hook_lsig_matches);
2547 2553
 		    ctx->hook_lsig_matches = old_hook_lsig_matches;
... ...
@@ -2560,7 +2566,8 @@ static int magic_scandesc(cli_ctx *ctx, cli_file_t type)
2560 2560
 		    cli_dbgmsg("Descriptor[%d]: Continuing after cli_scanraw reached %s\n",
2561 2561
 			fmap_fd(*ctx->fmap), cl_strerror(res));
2562 2562
 		    break;
2563
-		/* Other errors should not prevent later attempts to scan */
2563
+		/* Other errors must not block further scans below */
2564
+		/* This specifically includes CL_EFORMAT & CL_EREAD */
2564 2565
 		default:
2565 2566
 		    ret = res;
2566 2567
 		    cli_dbgmsg("Descriptor[%d]: Continuing after cli_scanraw error %s\n",
... ...
@@ -2672,7 +2679,7 @@ int cli_map_scandesc(cl_fmap_t *map, off_t offset, size_t length, cli_ctx *ctx)
2672 2672
     off_t old_off = map->nested_offset;
2673 2673
     size_t old_len = map->len;
2674 2674
     size_t old_real_len = map->real_len;
2675
-    int ret;
2675
+    int ret = CL_CLEAN;
2676 2676
 
2677 2677
     cli_dbgmsg("cli_map_scandesc: [%ld, +%ld), [%ld, +%ld)\n",
2678 2678
 	       old_off, old_len, offset, length);