author | Mark Lodato <lodatom@gmail.com> | 2010-09-04 15:30:18 (UTC) |
---|---|---|
committer | Mark Lodato <lodatom@gmail.com> | 2010-09-04 15:35:38 (UTC) |
commit | e4ddc8f72b5a7d8c55a6c2042c7b7f945ba4b1a2 (patch) (unidiff) | |
tree | 2ade0bb45e15ad5466ca4d3433201477f0c9214e /cgit.c | |
parent | a4c58d92bfee0cf2e35ab1c5e828a6d790108a69 (diff) | |
download | cgit-e4ddc8f72b5a7d8c55a6c2042c7b7f945ba4b1a2.zip cgit-e4ddc8f72b5a7d8c55a6c2042c7b7f945ba4b1a2.tar.gz cgit-e4ddc8f72b5a7d8c55a6c2042c7b7f945ba4b1a2.tar.bz2 |
fix errors in printf-style format strings
There were many places where the arguments to a printf-like function did
not match the format string. Mostly, these were a missing 'l' flag, but
there were three exceptions:
- In ui-stats.c, a size_t argument must be printed. C99 has the "%zu"
flag for this purpose, but not all compilers support this. Therefore,
we mimic what git does - use a NO_C99_FORMAT Makefile variable.
- In ui-stats.c, cgit_print_error() was called with a pointer instead of
a character.
- In ui-log.c, the "columns" argument was never used.
Signed-off-by: Mark Lodato <lodatom@gmail.com>
-rw-r--r-- | cgit.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -581,65 +581,65 @@ static int generate_cached_repolist(const char *path, const char *cached_rc) | |||
581 | if (!f) { | 581 | if (!f) { |
582 | /* Inform about the error unless the lockfile already existed, | 582 | /* Inform about the error unless the lockfile already existed, |
583 | * since that only means we've got concurrent requests. | 583 | * since that only means we've got concurrent requests. |
584 | */ | 584 | */ |
585 | if (errno != EEXIST) | 585 | if (errno != EEXIST) |
586 | fprintf(stderr, "[cgit] Error opening %s: %s (%d)\n", | 586 | fprintf(stderr, "[cgit] Error opening %s: %s (%d)\n", |
587 | locked_rc, strerror(errno), errno); | 587 | locked_rc, strerror(errno), errno); |
588 | return errno; | 588 | return errno; |
589 | } | 589 | } |
590 | idx = cgit_repolist.count; | 590 | idx = cgit_repolist.count; |
591 | if (ctx.cfg.project_list) | 591 | if (ctx.cfg.project_list) |
592 | scan_projects(path, ctx.cfg.project_list, repo_config); | 592 | scan_projects(path, ctx.cfg.project_list, repo_config); |
593 | else | 593 | else |
594 | scan_tree(path, repo_config); | 594 | scan_tree(path, repo_config); |
595 | print_repolist(f, &cgit_repolist, idx); | 595 | print_repolist(f, &cgit_repolist, idx); |
596 | if (rename(locked_rc, cached_rc)) | 596 | if (rename(locked_rc, cached_rc)) |
597 | fprintf(stderr, "[cgit] Error renaming %s to %s: %s (%d)\n", | 597 | fprintf(stderr, "[cgit] Error renaming %s to %s: %s (%d)\n", |
598 | locked_rc, cached_rc, strerror(errno), errno); | 598 | locked_rc, cached_rc, strerror(errno), errno); |
599 | fclose(f); | 599 | fclose(f); |
600 | return 0; | 600 | return 0; |
601 | } | 601 | } |
602 | 602 | ||
603 | static void process_cached_repolist(const char *path) | 603 | static void process_cached_repolist(const char *path) |
604 | { | 604 | { |
605 | struct stat st; | 605 | struct stat st; |
606 | char *cached_rc; | 606 | char *cached_rc; |
607 | time_t age; | 607 | time_t age; |
608 | unsigned long hash; | 608 | unsigned long hash; |
609 | 609 | ||
610 | hash = hash_str(path); | 610 | hash = hash_str(path); |
611 | if (ctx.cfg.project_list) | 611 | if (ctx.cfg.project_list) |
612 | hash += hash_str(ctx.cfg.project_list); | 612 | hash += hash_str(ctx.cfg.project_list); |
613 | cached_rc = xstrdup(fmt("%s/rc-%8x", ctx.cfg.cache_root, hash)); | 613 | cached_rc = xstrdup(fmt("%s/rc-%8lx", ctx.cfg.cache_root, hash)); |
614 | 614 | ||
615 | if (stat(cached_rc, &st)) { | 615 | if (stat(cached_rc, &st)) { |
616 | /* Nothing is cached, we need to scan without forking. And | 616 | /* Nothing is cached, we need to scan without forking. And |
617 | * if we fail to generate a cached repolist, we need to | 617 | * if we fail to generate a cached repolist, we need to |
618 | * invoke scan_tree manually. | 618 | * invoke scan_tree manually. |
619 | */ | 619 | */ |
620 | if (generate_cached_repolist(path, cached_rc)) { | 620 | if (generate_cached_repolist(path, cached_rc)) { |
621 | if (ctx.cfg.project_list) | 621 | if (ctx.cfg.project_list) |
622 | scan_projects(path, ctx.cfg.project_list, | 622 | scan_projects(path, ctx.cfg.project_list, |
623 | repo_config); | 623 | repo_config); |
624 | else | 624 | else |
625 | scan_tree(path, repo_config); | 625 | scan_tree(path, repo_config); |
626 | } | 626 | } |
627 | return; | 627 | return; |
628 | } | 628 | } |
629 | 629 | ||
630 | parse_configfile(cached_rc, config_cb); | 630 | parse_configfile(cached_rc, config_cb); |
631 | 631 | ||
632 | /* If the cached configfile hasn't expired, lets exit now */ | 632 | /* If the cached configfile hasn't expired, lets exit now */ |
633 | age = time(NULL) - st.st_mtime; | 633 | age = time(NULL) - st.st_mtime; |
634 | if (age <= (ctx.cfg.cache_scanrc_ttl * 60)) | 634 | if (age <= (ctx.cfg.cache_scanrc_ttl * 60)) |
635 | return; | 635 | return; |
636 | 636 | ||
637 | /* The cached repolist has been parsed, but it was old. So lets | 637 | /* The cached repolist has been parsed, but it was old. So lets |
638 | * rescan the specified path and generate a new cached repolist | 638 | * rescan the specified path and generate a new cached repolist |
639 | * in a child-process to avoid latency for the current request. | 639 | * in a child-process to avoid latency for the current request. |
640 | */ | 640 | */ |
641 | if (fork()) | 641 | if (fork()) |
642 | return; | 642 | return; |
643 | 643 | ||
644 | exit(generate_cached_repolist(path, cached_rc)); | 644 | exit(generate_cached_repolist(path, cached_rc)); |
645 | } | 645 | } |