Mercurial > hg > nginx-quic
view src/os/win32/ngx_errno.c @ 2764:d4a717592877
use ngx_vslprintf(), ngx_slprintf()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 27 Apr 2009 13:06:20 +0000 |
parents | e5a4be07c3eb |
children | 234ddbff1b2e |
line wrap: on
line source
/* * Copyright (C) Igor Sysoev */ #include <ngx_config.h> #include <ngx_core.h> u_char * ngx_strerror_r(ngx_err_t err, u_char *errstr, size_t size) { u_int len; if (size == 0) { return errstr; } len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), (char *) errstr, size, NULL); if (len == 0) { return ngx_snprintf(errstr, size, "FormatMessage() error:(%d)", GetLastError()); } /* remove ".\r\n\0" */ while (errstr[len] == '\0' || errstr[len] == CR || errstr[len] == LF || errstr[len] == '.') { --len; } return &errstr[++len]; }