1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-09-15 04:08:07 -04:00

Simplify log_syserr() (no need to be thread-safe)

Using strerror_r() w/ proper error checking is impossible, if the
system uses GNUisms (and losing _GNU_SOURCE's extensions is equally
painful)

Also, this change probably fixes a "abort() instead of error" bug.
This commit is contained in:
Moritz Grimm 2015-05-24 11:26:04 +02:00
parent 4c6a879303
commit b4fe40532a

View File

@ -22,7 +22,6 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syslog.h>
@ -110,8 +109,9 @@ log_syserr(enum log_levels lvl, int error, const char *pfx)
char errbuf[1024];
int ret;
if (0 != strerror_r(error, errbuf, sizeof(errbuf)))
abort();
if (!error)
return (0);
(void)snprintf(errbuf, sizeof(errbuf), "%s", strerror(error));
ret = _log(lvl, "%s%s%s",
pfx ? pfx : "",
pfx ? ": " : "",