Changeset 458 for trunk/src/sh_files.c
- Timestamp:
- Aug 5, 2014, 12:26:42 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_files.c
r457 r458 336 336 } 337 337 338 static int handle_filecheck_ret(dirstack_t * ptr, char * tmp_in, int status) 339 { 340 int fcount = 0; 341 char * tmp; 342 343 if (!tmp_in) 344 tmp = sh_util_safe_name (ptr->name); 345 else 346 tmp = tmp_in; 347 348 if (status == SH_FILE_UNKNOWN && (!SH_FFLAG_REPORTED_SET(ptr->is_reported))) 349 { 350 TPT(( 0, FIL__, __LINE__, _("msg=<file: %s> status=<%d>\n"), 351 tmp, status)); 352 353 if ( sh.flag.checkSum == SH_CHECK_INIT || 354 sh_hash_have_it (ptr->name) >= 0) 355 { 356 if (S_FALSE == sh_ignore_chk_del(ptr->name)) 357 { 358 if (0 != hashreport_missing(ptr->name, 359 (ptr->class == SH_LEVEL_ALLIGNORE) ? 360 ShDFLevel[ptr->class] : 361 ShDFLevel[SH_ERR_T_FILE])) { 362 if (tmp == NULL) 363 tmp = sh_util_safe_name (ptr->name); 364 sh_error_handle ((ptr->class == SH_LEVEL_ALLIGNORE) ? 365 ShDFLevel[ptr->class] : 366 ShDFLevel[SH_ERR_T_FILE], 367 FIL__, __LINE__, 0, MSG_FI_MISS, 368 tmp); 369 ++sh.statistics.files_report; 370 } 371 } 372 } 373 else /* not there at init, and still missing */ 374 { 375 if (tmp == NULL) 376 tmp = sh_util_safe_name (ptr->name); 377 sh_error_handle (SH_ERR_NOTICE, 378 FIL__, __LINE__, 0, 379 MSG_FI_FAIL, 380 tmp); 381 } 382 #ifndef REPLACE_OLD 383 /* this will tell that we have seen the file, and thus prevent 384 * deletion from the database, resulting in an incomplete 385 * message when the file reappears 386 */ 387 if (sh.flag.checkSum != SH_CHECK_INIT) 388 sh_hash_set_visited_true(ptr->name); 389 #else 390 if (sh.flag.checkSum != SH_CHECK_INIT) 391 sh_hash_set_missing(ptr->name); 392 #endif 393 if (sh.flag.reportonce == S_TRUE) 394 SET_SH_FFLAG_REPORTED(ptr->is_reported); 395 } 396 else 397 { 398 /* exists (status >= 0), but was missing (reported == TRUE) 399 */ 400 if (status != SH_FILE_UNKNOWN && SH_FFLAG_REPORTED_SET(ptr->is_reported)) 401 { 402 CLEAR_SH_FFLAG_REPORTED(ptr->is_reported); 403 sh_hash_clear_flag(ptr->name, SH_FFLAG_ENOENT); 404 } 405 406 /* Catchall 407 */ 408 else if (status == SH_FILE_UNKNOWN) 409 { 410 /* Thu Mar 7 15:09:40 CET 2002 Make sure missing file 411 * is reported if ptr->reported == S_TRUE because the 412 * file has been added. 413 */ 414 if (sh_hash_have_it (ptr->name) >= 0 && 415 !SH_FFLAG_REPORTED_SET(ptr->is_reported)) 416 { 417 if (S_FALSE == sh_ignore_chk_del(ptr->name)) 418 { 419 if (0 != hashreport_missing(ptr->name, 420 (ptr->class == SH_LEVEL_ALLIGNORE) ? 421 ShDFLevel[ptr->class] : 422 ShDFLevel[SH_ERR_T_FILE])) { 423 if (tmp == NULL) 424 tmp = sh_util_safe_name (ptr->name); 425 sh_error_handle ((ptr->class == SH_LEVEL_ALLIGNORE)? 426 ShDFLevel[ptr->class] : 427 ShDFLevel[SH_ERR_T_FILE], 428 FIL__, __LINE__, 0, MSG_FI_MISS, 429 tmp); 430 ++sh.statistics.files_report; 431 } 432 } 433 #ifndef REPLACE_OLD 434 if (sh.flag.checkSum != SH_CHECK_INIT) 435 sh_hash_set_visited_true(ptr->name); 436 #else 437 /* delete from database 438 */ 439 if (sh.flag.checkSum != SH_CHECK_INIT) 440 sh_hash_set_missing(ptr->name); 441 #endif 442 } 443 else 444 { 445 if (tmp == NULL) 446 tmp = sh_util_safe_name (ptr->name); 447 sh_error_handle (SH_ERR_INFO, FIL__, __LINE__, 0, 448 MSG_FI_FAIL, 449 tmp); 450 if (sh.flag.checkSum != SH_CHECK_INIT) 451 sh_hash_set_visited_true(ptr->name); 452 } 453 } 454 455 ++fcount; 456 } 457 if (!tmp_in) 458 SH_FREE(tmp); 459 460 return fcount; 461 } 462 463 338 464 unsigned long sh_files_chk () 339 465 { … … 396 522 tmp, status, ptr->is_reported)); 397 523 398 if (status == SH_FILE_UNKNOWN && (!SH_FFLAG_REPORTED_SET(ptr->is_reported))) 399 { 400 TPT(( 0, FIL__, __LINE__, _("msg=<file: %s> status=<%d>\n"), 401 tmp, status)); 402 403 if ( sh.flag.checkSum == SH_CHECK_INIT || 404 sh_hash_have_it (ptr->name) >= 0) 405 { 406 if (S_FALSE == sh_ignore_chk_del(ptr->name)) 407 { 408 if (0 != hashreport_missing(ptr->name, 409 (ptr->class == SH_LEVEL_ALLIGNORE) ? 410 ShDFLevel[ptr->class] : 411 ShDFLevel[SH_ERR_T_FILE])) { 412 if (tmp == NULL) 413 tmp = sh_util_safe_name (ptr->name); 414 sh_error_handle ((ptr->class == SH_LEVEL_ALLIGNORE) ? 415 ShDFLevel[ptr->class] : 416 ShDFLevel[SH_ERR_T_FILE], 417 FIL__, __LINE__, 0, MSG_FI_MISS, 418 tmp); 419 ++sh.statistics.files_report; 420 } 421 } 422 } 423 else /* not there at init, and still missing */ 424 { 425 if (tmp == NULL) 426 tmp = sh_util_safe_name (ptr->name); 427 sh_error_handle (SH_ERR_NOTICE, 428 FIL__, __LINE__, 0, 429 MSG_FI_FAIL, 430 tmp); 431 } 432 #ifndef REPLACE_OLD 433 /* this will tell that we have seen the file, and thus prevent 434 * deletion from the database, resulting in an incomplete 435 * message when the file reappears 436 */ 437 if (sh.flag.checkSum != SH_CHECK_INIT) 438 sh_hash_set_visited_true(ptr->name); 439 #else 440 if (sh.flag.checkSum != SH_CHECK_INIT) 441 sh_hash_set_missing(ptr->name); 442 #endif 443 if (sh.flag.reportonce == S_TRUE) 444 SET_SH_FFLAG_REPORTED(ptr->is_reported); 445 } 446 else 447 { 448 /* exists (status >= 0), but was missing (reported == TRUE) 449 */ 450 if (status != SH_FILE_UNKNOWN && SH_FFLAG_REPORTED_SET(ptr->is_reported)) 451 { 452 CLEAR_SH_FFLAG_REPORTED(ptr->is_reported); 453 } 454 455 /* Catchall 456 */ 457 else if (status == SH_FILE_UNKNOWN) 458 { 459 /* Thu Mar 7 15:09:40 CET 2002 Make sure missing file 460 * is reported if ptr->reported == S_TRUE because the 461 * file has been added. 462 */ 463 if (sh_hash_have_it (ptr->name) >= 0 && 464 !SH_FFLAG_REPORTED_SET(ptr->is_reported)) 465 { 466 if (S_FALSE == sh_ignore_chk_del(ptr->name)) 467 { 468 if (0 != hashreport_missing(ptr->name, 469 (ptr->class == SH_LEVEL_ALLIGNORE) ? 470 ShDFLevel[ptr->class] : 471 ShDFLevel[SH_ERR_T_FILE])) { 472 if (tmp == NULL) 473 tmp = sh_util_safe_name (ptr->name); 474 sh_error_handle ((ptr->class == SH_LEVEL_ALLIGNORE)? 475 ShDFLevel[ptr->class] : 476 ShDFLevel[SH_ERR_T_FILE], 477 FIL__, __LINE__, 0, MSG_FI_MISS, 478 tmp); 479 ++sh.statistics.files_report; 480 } 481 } 482 #ifndef REPLACE_OLD 483 if (sh.flag.checkSum != SH_CHECK_INIT) 484 sh_hash_set_visited_true(ptr->name); 485 #else 486 /* delete from database 487 */ 488 if (sh.flag.checkSum != SH_CHECK_INIT) 489 sh_hash_set_missing(ptr->name); 490 #endif 491 } 492 else 493 { 494 if (tmp == NULL) 495 tmp = sh_util_safe_name (ptr->name); 496 sh_error_handle (SH_ERR_INFO, FIL__, __LINE__, 0, 497 MSG_FI_FAIL, 498 tmp); 499 if (sh.flag.checkSum != SH_CHECK_INIT) 500 sh_hash_set_visited_true(ptr->name); 501 } 502 } 503 ++fcount; 504 } 524 fcount += handle_filecheck_ret(ptr, tmp, status); 505 525 506 526 if (tmp != NULL) … … 1475 1495 dirstack_t * dst_ptr; 1476 1496 int status; 1497 int tmp_reported; 1498 volatile int filetype = SH_FILE_UNKNOWN; 1477 1499 volatile unsigned long dcount = 0; 1478 1500 char * tmp; … … 1508 1530 { 1509 1531 BREAKEXIT(sh_files_filecheck); 1510 sh_files_filecheck (dst_ptr->class, dst_ptr->check_mask, 1511 ptr->name, 1512 NULL, &status, 0); 1532 tmp_reported = dst_ptr->is_reported; 1533 filetype = sh_files_filecheck (dst_ptr->class, dst_ptr->check_mask, 1534 ptr->name, 1535 NULL, &tmp_reported, 0); 1536 dst_ptr->is_reported = tmp_reported; 1537 (void) handle_filecheck_ret(dst_ptr, NULL, filetype); 1538 1513 1539 dst_ptr->checked = S_TRUE; 1514 1540 status = S_TRUE; … … 1522 1548 1523 1549 if (status == S_FALSE) 1524 sh_files_filecheck (ptr->class, ptr->check_mask, 1525 ptr->name, NULL, &status, 0); 1550 { 1551 tmp_reported = ptr->is_reported; 1552 filetype = sh_files_filecheck (ptr->class, ptr->check_mask, 1553 ptr->name, NULL, &tmp_reported, 0); 1554 ptr->is_reported = tmp_reported; 1555 (void) handle_filecheck_ret(ptr, NULL, filetype); 1556 } 1526 1557 1527 1558 BREAKEXIT(sh_files_checkdir); … … 1559 1590 { 1560 1591 CLEAR_SH_FFLAG_REPORTED(ptr->is_reported); 1592 sh_hash_clear_flag(ptr->name, SH_FFLAG_ENOENT); 1561 1593 #if 0 1562 1594 /* obsoleted (really?) by the mandatory sh_files_filecheck() … … 2661 2693 } 2662 2694 2663 2664 2695 /* stat the file and determine checksum (if a regular file) 2665 2696 */
Note:
See TracChangeset
for help on using the changeset viewer.