I don't see why you would want buf2 to be static in nature. If you have a file that contains a single newline, for example, parse_date() returns -1. buf2 still contains the previous date's file.
Consequently, if you call read_agefile() several times in a row, the stack might just contain the previous date still. Thus, there's a need to initialize it properly. Signed-off-by: Julius Plenz <[email protected]> --- ui-repolist.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/ui-repolist.c b/ui-repolist.c index 2c98668..4431145 100644 --- a/ui-repolist.c +++ b/ui-repolist.c @@ -15,11 +15,12 @@ time_t read_agefile(char *path) time_t result; size_t size; char *buf; - static char buf2[64]; + char buf2[64]; if (readfile(path, &buf, &size)) return -1; + memset(buf2, 0, 64); if (parse_date(buf, buf2, sizeof(buf2))) result = strtoul(buf2, NULL, 10); else -- 1.7.3.1 _______________________________________________ cgit mailing list [email protected] http://hjemli.net/mailman/listinfo/cgit
