view src/os/unix/ngx_errno.c @ 469:2ff194b74f1e release-0.1.9

nginx-0.1.9-RELEASE import *) Bugfix: the proxied request was sent without arguments if the request contains "//", "/./", "/../" or "%XX". *) Bugfix: the large compressed responses may be transferred not completely. *) Bugfix: the files bigger than 2G was not transferred on Linux that does not support sendfile64(). *) Bugfix: while the build configuration on Linux the --with-poll_module parameter was required; the bug had appeared in 0.1.8.
author Igor Sysoev <igor@sysoev.ru>
date Thu, 25 Nov 2004 16:17:31 +0000
parents a88a3e4e158f
children d4ea69372b94
line wrap: on
line source


/*
 * Copyright (C) Igor Sysoev
 */


#include <ngx_config.h>
#include <ngx_core.h>


#if (NGX_HAVE_STRERROR_R)

u_char *ngx_strerror_r(int err, u_char *errstr, size_t size)
{
    if (size == 0) {
        return 0;
    }

    errstr[0] = '\0';

    strerror_r(err, (char *) errstr, size);

    while (*errstr && size) {
        errstr++;
        size--;
    }

    return errstr;
}

#elif (NGX_HAVE_GNU_STRERROR_R)

/* Linux strerror_r() */

u_char *ngx_strerror_r(int err, u_char *errstr, size_t size)
{
    char    *str;
    size_t   len;

    if (size == 0) {
        return 0;
    }

    errstr[0] = '\0';

    str = strerror_r(err, (char *) errstr, size);

    if (str != (char *) errstr) {
        return ngx_cpystrn(errstr, (u_char *) str, size);
    }

    while (*errstr && size) {
        errstr++;
        size--;
    }

    return errstr;
}

#endif