From a6a884d250900f2d7abcd1523aa4d97db520b9c2 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 4 Nov 2017 19:28:34 +0100 Subject: [PATCH] daemon/common.h: Add the STRERROR() and STRERRNO macros. --- src/daemon/common.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/daemon/common.h b/src/daemon/common.h index 7f860521..cf4c5a71 100644 --- a/src/daemon/common.h +++ b/src/daemon/common.h @@ -73,6 +73,13 @@ char *sstrdup(const char *s); void *smalloc(size_t size); char *sstrerror(int errnum, char *buf, size_t buflen); +#ifndef ERRBUF_SIZE +#define ERRBUF_SIZE 256 +#endif + +#define STRERROR(e) sstrerror((e), (char[ERRBUF_SIZE]){0}, ERRBUF_SIZE) +#define STRERRNO STRERROR(errno) + /* * NAME * sread -- 2.11.0