local.fix-buffer-weirdness.patch 829 B

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