| 521 | } |
| 522 | |
| 523 | static bool verify_file(const char *path) |
| 524 | { |
| 525 | struct stat buf; |
| 526 | |
| 527 | if (stat(path, &buf) < 0) |
| 528 | { |
| 529 | /* It may be okay if the file does not exist */ |
| 530 | |
| 531 | int errcode = errno; |
| 532 | if (errcode == ENOENT) |
| 533 | { |
| 534 | debug("verify_file: stat of %s failed: %s\n", |
| 535 | path, strerror(errno)); |
| 536 | return false; |
| 537 | } |
| 538 | else |
| 539 | { |
| 540 | fprintf(stderr, "ERROR: stat of %s failed: %s\n", |
| 541 | path, strerror(errno)); |
| 542 | exit(EXIT_FAILURE); |
| 543 | } |
| 544 | } |
| 545 | |
| 546 | if (!S_ISREG(buf.st_mode)) |
| 547 | { |
| 548 | fprintf(stderr, "ERROR: %s exists but is not a regular file\n", path); |
| 549 | exit(EXIT_FAILURE); |
| 550 | } |
| 551 | |
| 552 | return true; |
| 553 | } |
| 554 | |
| 555 | static void find_topdir(void) |
| 556 | { |
no test coverage detected