From e1cb35fc7630f113648e362ef77d659cc0863891 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 30 Nov 2010 19:56:08 -0500 Subject: fix up commenting --- expac.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/expac.c b/expac.c index cd25050..472c63f 100644 --- a/expac.c +++ b/expac.c @@ -3,9 +3,9 @@ #include #include #include +#include #include #include -#include #include #define FORMAT_TOKENS "BCDEFGLNOPRSabdfiklmnprsuv%" @@ -266,7 +266,7 @@ static void print_list(alpm_list_t *list, extractfn fn, bool shortdeps) { while (1) { char *item; - item = fn ? (char*)fn(alpm_list_getdata(i)) : (char*)alpm_list_getdata(i); + item = (char*)(fn ? fn(alpm_list_getdata(i)) : alpm_list_getdata(i)); if (shortdeps) { *(item + strcspn(item, "<>=")) = '\0'; @@ -294,6 +294,7 @@ static void print_time(time_t timestamp) { return; } + /* no overflow here, strftime prints a max of 64 including null */ strftime(&buffer[0], 64, timefmt, localtime(×tamp)); printf("%s", buffer); } @@ -394,7 +395,7 @@ static int print_pkg(pmpkg_t *pkg, const char *format) { break; } } else if (*f == '\\') { - char buf[3]; + char buf[3]; /* its not safe to do this in a single sprintf */ buf[0] = *f; buf[1] = *++f; buf[2] = '\0'; @@ -477,7 +478,7 @@ int main(int argc, char *argv[]) { ret = alpm_init(); if (ret != 0) { - return(1); + return(ret); } ret = parse_options(argc, argv); @@ -485,7 +486,7 @@ int main(int argc, char *argv[]) { goto finish; } - /* default vals */ + /* ensure sane defaults */ if (!dblist) { dblist = alpm_list_add(dblist, db_local); } -- cgit v1.2.3-70-g09d2