]> git.ipfire.org Git - thirdparty/squid.git/blame - compat/xstrerror.cc
Bug 3038: Detatch libmisc from libcompat
[thirdparty/squid.git] / compat / xstrerror.cc
CommitLineData
25f98340
AJ
1#include "config.h"
2#include "compat/xstrerror.h"
3
4#if HAVE_STRING_H
5#include <string.h>
6#endif
7
8const char *
9xstrerr(int error)
10{
11 static char xstrerror_buf[BUFSIZ];
12 const char *errmsg = strerror(error);
13
14 if (!errmsg || !*errmsg)
15 errmsg = "Unknown error";
16
17 snprintf(xstrerror_buf, BUFSIZ, "(%d) %s", error, errmsg);
18
19 return xstrerror_buf;
20}