1234567891011121314151617181920212223242526272829 |
- Description: These operations aren't broken, but just weird
- Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
- Forwarded: No
- Last-Update: 2014-06-07
- --- a/util.c
- +++ b/util.c
- @@ -46,7 +46,7 @@
- _log(LOG_##lvl, #lvl_str, fmt, args)
-
- static char *now_str() {
- - static char buffer[1000];
- + static char buffer[20];
- time_t now = time(0);
- strftime(buffer, sizeof buffer, "%Y-%m-%d %H:%M:%S", localtime(&now));
- return buffer;
- @@ -56,9 +56,9 @@
- if(use_syslog) {
- syslog(lvl, fmt, args);
- } else {
- - char prefix[strlen(fmt) + 1000];
- - sprintf(prefix, "%s [%s] %s\n", now_str(), lvl_str, fmt);
- - vfprintf(stderr, prefix, args);
- + fprintf(stderr, "%s [%s] ", now_str(), lvl_str);
- + vfprintf(stderr, fmt, args);
- + fputc ('\n', stderr);
- }
- }
-
|