2
* Copyright (C) 2009 Sourcefire, Inc.
4
* Authors: aCaB <acab@clamav.net>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22
#include "w32_errno.h"
24
char *w32_strerror(int errnum) {
26
for(i=0; i<sizeof(w32_errnos) / sizeof(w32_errnos[0]); i++) {
27
if(w32_errnos[i].err == errnum)
28
return w32_errnos[i].strerr;
30
return "Unknown error";
33
int w32_strerror_r(int errnum, char *buf, size_t buflen) {
34
strncpy(buf, w32_strerror(errnum), buflen);
35
if(buflen) buf[buflen-1] = '\0';