randy       97/08/31 14:28:59

  Modified:    src/main http_config.c http_core.c http_log.c
                        http_protocol.c http_request.c rfc1413.c
                        util_script.c
  Log:
  Complete conversion of src/main/* to aplog_error(). On to the modules...
  
  Revision  Changes    Path
  1.78      +8 -7      apachen/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/http_config.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- http_config.c     1997/08/27 05:45:34     1.77
  +++ http_config.c     1997/08/31 21:28:49     1.78
  @@ -934,9 +934,9 @@
       while (!f && access_name[0]) {
        char *w = getword_conf(r->pool, &access_name);
        filename = make_full_path(r->pool, d, w);
  -     f=pfopen(r->pool, filename, "r");
  +     f = pfopen(r->pool, filename, "r");
       }
  -    if(f) {
  +    if (f) {
           dc = create_per_dir_config (r->pool);
        
           parms.infile = f;
  @@ -947,18 +947,19 @@
           pfclose(r->pool, f);
   
        if (errmsg) {
  -         log_reason (errmsg, filename, r);
  +         aplog_error(APLOG_MARK, APLOG_ALERT, r->server, "%s: %s", filename, 
errmsg);
            return SERVER_ERROR;
        }
        
        *result = dc;
  -    } else {
  +    }
  +    else {
        if (errno == ENOENT || errno == ENOTDIR)
            dc = NULL;
        else {
  -         log_unixerr("pfopen", filename, 
  -             "unable to check htaccess file, ensure it is readable",
  -             r->server);
  +         aplog_error(APLOG_MARK, APLOG_CRIT, r->server,
  +                     "%s pfopen: unable to check htaccess file, ensure it is 
readable",
  +                     filename);
            return HTTP_FORBIDDEN;
        }
       }
  
  
  
  1.116     +23 -18    apachen/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/http_core.c,v
  retrieving revision 1.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- http_core.c       1997/08/27 05:45:35     1.115
  +++ http_core.c       1997/08/31 21:28:50     1.116
  @@ -1224,14 +1224,14 @@
       rlim_t cur = 0;
       rlim_t max = 0;
   
  -    *plimit=(struct rlimit *)pcalloc(cmd->pool,sizeof **plimit);
  -    limit=*plimit;
  -    if ((getrlimit(type, limit)) != 0)
  -     {
  +    *plimit = (struct rlimit *)pcalloc(cmd->pool,sizeof **plimit);
  +    limit = *plimit;
  +    if ((getrlimit(type, limit)) != 0)       {
        *plimit = NULL;
  -     log_unixerr("getrlimit",cmd->cmd->name,"failed",cmd->server);
  +     aplog_error(APLOG_MARK, APLOG_ERR, cmd->server,
  +                 "%s: getrlimit failed", cmd->cmd->name);
        return;
  -     }
  +    }
   
       if ((str = getword_conf(cmd->pool, &arg)))
        if (!strcasecmp(str, "max"))
  @@ -1239,7 +1239,8 @@
        else
            cur = atol(str);
       else {
  -     log_printf(cmd->server, "Invalid parameters for %s", cmd->cmd->name);
  +     aplog_error(APLOG_MARK, APLOG_ERR, cmd->server,
  +                 "Invalid parameters for %s", cmd->cmd->name);
        return;
       }
       
  @@ -1250,8 +1251,8 @@
       if (geteuid()) {
        limit->rlim_cur = cur;
        if (max)
  -         log_printf(cmd->server, "Must be uid 0 to raise maximum %s",
  -                   cmd->cmd->name);
  +         aplog_error(APLOG_MARK, APLOG_ERR, cmd->server,
  +                     "Must be uid 0 to raise maximum %s", cmd->cmd->name);
       }
       else {
        if (cur)
  @@ -1266,8 +1267,8 @@
   static const char *no_set_limit (cmd_parms *cmd, core_dir_config *conf,
                                 char *arg, char *arg2)
   {
  -    log_printf(cmd->server, "%s not supported on this platform",
  -            cmd->cmd->name);
  +    aplog_error(APLOG_MARK, APLOG_ERR, cmd->server,
  +             "%s not supported on this platform", cmd->cmd->name);
       return NULL;
   }
   #endif
  @@ -1542,7 +1543,8 @@
     
       if (r->proxyreq) return HTTP_FORBIDDEN;
       if ((r->uri[0] != '/') && strcmp(r->uri, "*")) {
  -     log_printf(r->server, "Invalid URI in request %s", r->the_request);
  +     aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                 "Invalid URI in request %s", r->the_request);
        return BAD_REQUEST;
       }
       
  @@ -1603,16 +1605,17 @@
       r->allowed |= (1 << M_OPTIONS);
   
       if (r->method_number == M_INVALID) {
  -     log_printf(r->server, "Invalid method in request %s", r->the_request);
  +     aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                 "Invalid method in request %s", r->the_request);
        return NOT_IMPLEMENTED;
       }
       if (r->method_number == M_OPTIONS) return send_http_options(r);
       if (r->method_number == M_PUT) return METHOD_NOT_ALLOWED;
   
       if (r->finfo.st_mode == 0 || (r->path_info && *r->path_info)) {
  -     log_reason("File does not exist",
  -         r->path_info ? pstrcat(r->pool, r->filename, r->path_info, NULL)
  -             : r->filename, r);
  +     aplog_error(APLOG_MARK, APLOG_ERR, r->server, "File does not exist: %s",
  +                 r->path_info ? pstrcat(r->pool, r->filename, r->path_info, 
NULL)
  +                 : r->filename, r);
        return NOT_FOUND;
       }
       if (r->method_number != M_GET) return METHOD_NOT_ALLOWED;
  @@ -1625,7 +1628,8 @@
   #endif
   
       if (f == NULL) {
  -        log_reason("file permissions deny server access", r->filename, r);
  +        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                 "file permissions deny server access: %s", r->filename);
           return FORBIDDEN;
       }
        
  @@ -1647,7 +1651,8 @@
       if (mm == (caddr_t)-1) {
        unblock_alarms();
   
  -     log_unixerr ("mmap_handler", r->filename, "mmap failed", r->server);
  +     aplog_error(APLOG_MARK, APLOG_CRIT, r->server,
  +                 "mmap_handler: mmap failed: %s", r->filename);
   #endif
   
        if (d->content_md5 & 1) {
  
  
  
  1.30      +3 -0      apachen/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/http_log.c,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- http_log.c        1997/08/27 15:51:27     1.29
  +++ http_log.c        1997/08/31 21:28:51     1.30
  @@ -66,6 +66,7 @@
   
   #include <stdarg.h>
   
  +
   #ifdef HAVE_SYSLOG
   #include <syslog.h>
   
  @@ -156,8 +157,10 @@
   
        s->error_log = dummy;
       }
  +
   #ifdef HAVE_SYSLOG
       else if (!strncasecmp(s->error_fname, "syslog", 6)) {
  +     register TRANS *fac;
        if ((fname = strchr(s->error_fname, ':'))) {
            fname++;
            for (fac = facilities; fac->t_name; fac++) {
  
  
  
  1.156     +29 -24    apachen/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/http_protocol.c,v
  retrieving revision 1.155
  retrieving revision 1.156
  diff -u -r1.155 -r1.156
  --- http_protocol.c   1997/08/18 07:19:36     1.155
  +++ http_protocol.c   1997/08/31 21:28:52     1.156
  @@ -644,8 +644,9 @@
   #endif /* SIGUSR1 */
       bsetflag( conn->client, B_SAFEREAD, 0 );
       if (len == (HUGE_STRING_LEN - 1)) {
  -        log_printf(r->server, "request failed for %s, reason: URI too long",
  -            get_remote_host(r->connection, r->per_dir_config, REMOTE_NAME));
  +        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                 "request failed for %s, reason: URI too long",
  +                 get_remote_host(r->connection, r->per_dir_config, 
REMOTE_NAME));
           r->status = HTTP_REQUEST_URI_TOO_LARGE;
           return 0;
       }
  @@ -963,7 +964,7 @@
   
   API_EXPORT(int) get_basic_auth_pw (request_rec *r, char **pw)
   {
  -    const char *auth_line = table_get (r->headers_in, r->proxyreq ? 
  +    const char *auth_line = table_get(r->headers_in, r->proxyreq ? 
                                                      "Proxy-Authorization" :
                                                      "Authorization");
       char *t;
  @@ -971,25 +972,26 @@
       if(!(t = auth_type(r)) || strcasecmp(t, "Basic"))
           return DECLINED;
   
  -    if (!auth_name (r)) {
  -        log_reason ("need AuthName", r->uri, r);
  +    if (!auth_name(r)) {
  +        aplog_error(APLOG_MARK, APLOG_ERR, r->server, "need AuthName: %s", 
r->uri);
        return SERVER_ERROR;
       }
       
  -    if(!auth_line) {
  +    if (!auth_line) {
           note_basic_auth_failure (r);
        return AUTH_REQUIRED;
       }
   
       if (strcmp(getword (r->pool, &auth_line, ' '), "Basic")) {
           /* Client tried to authenticate using wrong auth scheme */
  -        log_reason ("client used wrong authentication scheme", r->uri, r);
  -        note_basic_auth_failure (r);
  +        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                 "client used wrong authentication scheme: %s", r->uri);
  +        note_basic_auth_failure(r);
        return AUTH_REQUIRED;
       }
   
  -    t = uudecode (r->pool, auth_line);
  -    r->connection->user = getword_nulls_nc (r->pool, &t, ':');
  +    t = uudecode(r->pool, auth_line);
  +    r->connection->user = getword_nulls_nc(r->pool, &t, ':');
       r->connection->auth_type = "Basic";
   
       *pw = t;
  @@ -1380,11 +1382,13 @@
   
       if (tenc) {
           if (strcasecmp(tenc, "chunked")) {
  -            log_printf(r->server, "Unknown Transfer-Encoding %s", tenc);
  +            aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "Unknown Transfer-Encoding %s", tenc);
               return HTTP_BAD_REQUEST;
           }
           if (r->read_body == REQUEST_CHUNKED_ERROR) {
  -            log_reason("chunked Transfer-Encoding forbidden", r->uri, r);
  +            aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "chunked Transfer-Encoding forbidden: %s", r->uri);
               return (lenp) ? HTTP_BAD_REQUEST : HTTP_LENGTH_REQUIRED;
           }
   
  @@ -1395,7 +1399,8 @@
   
           while (isdigit(*pos) || isspace(*pos)) ++pos;
           if (*pos != '\0') {
  -            log_printf(r->server, "Invalid Content-Length %s", lenp);
  +            aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "Invalid Content-Length %s", lenp);
               return HTTP_BAD_REQUEST;
           }
   
  @@ -1404,8 +1409,8 @@
   
       if ((r->read_body == REQUEST_NO_BODY) &&
           (r->read_chunked || (r->remaining > 0))) {
  -        log_printf(r->server, "%s with body is not allowed for %s",
  -                   r->method, r->uri);
  +        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                 "%s with body is not allowed for %s", r->method, r->uri);
           return HTTP_REQUEST_ENTITY_TOO_LARGE;
       }
   
  @@ -1666,10 +1671,10 @@
                   else if (errno == EAGAIN)
                       continue;
                   else {
  -                    log_unixerr("send body lost connection to",
  +                    aplog_error(APLOG_MARK, APLOG_NOTICE, r->server,
  +                             "send body lost connection to %s",
                                   get_remote_host(r->connection,
  -                                    r->per_dir_config, REMOTE_NAME),
  -                                NULL, r->server);
  +                                             r->per_dir_config, 
REMOTE_NAME));
                       bsetflag(r->connection->client, B_EOUT, 1);
                       r->connection->aborted = 1;
                       break;
  @@ -1745,10 +1750,10 @@
                   else if (errno == EAGAIN)
                       continue;
                   else {
  -                    log_unixerr("send body lost connection to",
  +                    aplog_error(APLOG_MARK, APLOG_NOTICE, r->server,
  +                             "send body lost connection to %s",
                                   get_remote_host(r->connection,
  -                                    r->per_dir_config, REMOTE_NAME),
  -                                NULL, r->server);
  +                                             r->per_dir_config, 
REMOTE_NAME));
                       bsetflag(r->connection->client, B_EOUT, 1);
                       r->connection->aborted = 1;
                       break;
  @@ -1807,10 +1812,10 @@
                   else if (errno == EAGAIN)
                       continue;
                   else {
  -                    log_unixerr("send mmap lost connection to",
  +                    aplog_error(APLOG_MARK, APLOG_NOTICE, r->server,
  +                             "send mmap lost connection to %s",
                                   get_remote_host(r->connection,
  -                                    r->per_dir_config, REMOTE_NAME),
  -                                NULL, r->server);
  +                                             r->per_dir_config, 
REMOTE_NAME));
                       bsetflag(r->connection->client, B_EOUT, 1);
                       r->connection->aborted = 1;
                       break;
  
  
  
  1.81      +21 -20    apachen/src/main/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/http_request.c,v
  retrieving revision 1.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- http_request.c    1997/08/31 16:28:51     1.80
  +++ http_request.c    1997/08/31 21:28:53     1.81
  @@ -99,7 +99,8 @@
        || S_ISLNK (r->finfo.st_mode)) {
        return OK;
       }
  -    log_reason("object is not a file, directory or symlink", r->filename, r);
  +    aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +             "object is not a file, directory or symlink: %s", r->filename);
       return HTTP_FORBIDDEN;
   }
   
  @@ -230,10 +231,9 @@
   #if defined(EACCES)
            if (errno != EACCES) 
   #endif 
  -         log_printf(r->server, 
  -            "access to %s failed for %s, reason: stat: %s (errno = %d)",
  -            r->uri, get_remote_host(r->connection, r->per_dir_config,
  -            REMOTE_NAME), strerror(errno), errno);
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server, 
  +                     "access to %s failed for %s", r->uri,
  +                     get_remote_host(r->connection, r->per_dir_config, 
REMOTE_NAME));
   
            return HTTP_FORBIDDEN;
        }
  @@ -363,7 +363,8 @@
         */
        
        if ((res = check_symlinks (test_dirname, core_dir->opts))) {
  -         log_reason("Symbolic link not allowed", test_dirname, r);
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "Symbolic link not allowed: %s", test_dirname);
            return res;
        }
   
  @@ -457,7 +458,8 @@
        */
       if (!S_ISDIR (r->finfo.st_mode)
        && (res = check_symlinks (r->filename, allow_options(r)))) {
  -     log_reason("Symbolic link not allowed", r->filename, r);
  +     aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                 "Symbolic link not allowed: %s", r->filename);
        return res;
       }
       
  @@ -739,7 +741,8 @@
            }
        } else {
            if ((res = check_symlinks (rnew->filename, allow_options (rnew)))) {
  -             log_reason ("Symbolic link not allowed", rnew->filename, rnew);
  +             aplog_error(APLOG_MARK, APLOG_ERR, rnew->server,
  +                         "Symbolic link not allowed: %s", rnew->filename);
                rnew->status = res;
                return rnew;
            }
  @@ -877,8 +880,8 @@
             * --- fake up dying with a recursive server error...
             */
            recursive_error = SERVER_ERROR;
  -         log_reason("Invalid error redirection directive", custom_response,
  -                    r);
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "Invalid error redirection directive: %s", 
custom_response);
        }       
       }
   
  @@ -888,11 +891,8 @@
   static void decl_die (int status, char *phase, request_rec *r)
   {
       if (status == DECLINED) {
  -     log_reason (pstrcat (r->pool,
  -                          "configuration error:  couldn't ",
  -                          phase, NULL),
  -                 r->uri,
  -                 r);
  +     aplog_error(APLOG_MARK, APLOG_CRIT, r->server,
  +                 "configuration error:  couldn't %s: %s", phase, r->uri);
        die (SERVER_ERROR, r);
       }
       else die (status, r);
  @@ -930,9 +930,10 @@
         * send headers!  Have to dink things even to make sure the
         * error message comes through...
         */
  -     log_reason ("client sent illegal HTTP/0.9 request", r->uri, r);
  +     aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                 "client sent illegal HTTP/0.9 request: %s", r->uri);
        r->header_only = 0;
  -     die (BAD_REQUEST, r);
  +     die(BAD_REQUEST, r);
        return;
       }
   
  @@ -942,9 +943,9 @@
         * us the hostname, either with a full URL or a Host: header.
         * We therefore need to (as per the 1.1 spec) send an error
         */
  -        log_reason ("client sent HTTP/1.1 request without hostname",
  -                 r->uri, r);
  -     die (BAD_REQUEST, r);
  +        aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                 "client sent HTTP/1.1 request without hostname: %s", 
r->uri);
  +     die(BAD_REQUEST, r);
        return;
       }
   
  
  
  
  1.15      +14 -16    apachen/src/main/rfc1413.c
  
  Index: rfc1413.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/rfc1413.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- rfc1413.c 1997/08/02 00:58:28     1.14
  +++ rfc1413.c 1997/08/31 21:28:54     1.15
  @@ -73,7 +73,7 @@
   /* Rewritten by David Robinson */
   
   #include "httpd.h"    /* for server_rec, conn_rec, ap_longjmp, etc. */
  -#include "http_log.h" /* for log_unixerr */
  +#include "http_log.h" /* for aplog_error */
   #include "rfc1413.h"
   #include "http_main.h" /* set_callback_and_alarm */
   
  @@ -124,7 +124,8 @@
       if (bind(sock, (struct sockaddr *)&our_query_sin,
             sizeof(struct sockaddr_in)) < 0)
       {
  -     log_unixerr("bind", NULL, "rfc1413: Error binding to local port", srv);
  +     aplog_error(APLOG_MARK, APLOG_CRIT, srv,
  +                 "bind: rfc1413: Error binding to local port", srv);
        return -1;
       }
   
  @@ -141,9 +142,9 @@
            ntohs(our_sin->sin_port));
       do i = write(sock, buffer, strlen(buffer));
       while (i == -1 && errno == EINTR);
  -    if (i == -1)
  -    {
  -     log_unixerr("write", NULL, "rfc1413: error sending request", srv);
  +    if (i == -1) {
  +     aplog_error(APLOG_MARK, APLOG_CRIT, srv,
  +                 "write: rfc1413: error sending request");
        return -1;
       }
   
  @@ -154,9 +155,9 @@
       
       do i = read(sock, buffer, RFC1413_MAXDATA);
       while (i == -1 && errno == EINTR);
  -    if (i == -1)
  -    {
  -     log_unixerr("read", NULL, "rfc1413: error reading response", srv);
  +    if (i == -1) {
  +     aplog_error(APLOG_MARK, APLOG_CRIT, srv,
  +                 "read: rfc1413: error reading response");
        return -1;
       }
   
  @@ -194,22 +195,19 @@
       result = FROM_UNKNOWN;
   
       sock = psocket(conn->pool, AF_INET, SOCK_STREAM, IPPROTO_TCP);
  -    if (sock < 0)
  -    {
  -     log_unixerr("socket", NULL, "rfc1413: error creating socket", srv);
  +    if (sock < 0) {
  +     aplog_error(APLOG_MARK, APLOG_CRIT, srv,
  +                 "socket: rfc1413: error creating socket");
        conn->remote_logname = result;
       }
   
       /*
        * Set up a timer so we won't get stuck while waiting for the server.
        */
  -    if (ap_setjmp(timebuf) == 0)
  -    {
  +    if (ap_setjmp(timebuf) == 0) {
           set_callback_and_alarm(ident_timeout, rfc1413_timeout);
        
  -     if (get_rfc1413(sock, &conn->local_addr, &conn->remote_addr, user,
  -                   srv)
  -         >= 0)
  +     if (get_rfc1413(sock, &conn->local_addr, &conn->remote_addr, user, srv) 
>= 0)
            result = user;
   
        set_callback_and_alarm(NULL, 0);
  
  
  
  1.70      +38 -33    apachen/src/main/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /export/home/cvs/apachen/src/main/util_script.c,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- util_script.c     1997/08/05 06:33:26     1.69
  +++ util_script.c     1997/08/31 21:28:54     1.70
  @@ -339,27 +339,27 @@
   
        if ((*getsfunc)(w, MAX_STRING_LEN-1, getsfunc_data) == 0) {
            kill_timeout (r);
  -         log_reason ("Premature end of script headers", r->filename, r);
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "Premature end of script headers: %s", r->filename);
            return SERVER_ERROR;
           }
   
        /* Delete terminal (CR?)LF */
        
        p = strlen(w);
  -     if (p > 0 && w[p-1] == '\n')
  -     {
  +     if (p > 0 && w[p-1] == '\n') {
            if (p > 1 && w[p-2] == '\015') w[p-2] = '\0';
            else w[p-1] = '\0';
        }
   
  -        if(w[0] == '\0') {
  +        if (w[0] == '\0') {
            kill_timeout (r);
            return OK;
        }
                                      
        /* if we see a bogus header don't ignore it. Shout and scream */
        
  -        if(!(l = strchr(w,':'))) {
  +        if (!(l = strchr(w,':'))) {
            char malformed[(sizeof 
MALFORMED_MESSAGE)+1+MALFORMED_HEADER_LENGTH_TO_SHOW];
               strcpy(malformed, MALFORMED_MESSAGE);
               strncat(malformed, w, MALFORMED_HEADER_LENGTH_TO_SHOW);
  @@ -370,7 +370,8 @@
                continue;
            
            kill_timeout (r);
  -         log_reason (malformed, r->filename, r);
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "%s: %s", malformed, r->filename);
            return SERVER_ERROR;
           }
   
  @@ -505,26 +506,26 @@
   #ifdef RLIMIT_CPU
       if (conf->limit_cpu != NULL)
        if ((setrlimit (RLIMIT_CPU, conf->limit_cpu)) != 0)
  -         log_unixerr("setrlimit", NULL, "failed to set CPU usage limit",
  -                     r->server);
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "setrlimit: failed to set CPU usage limit");
   #endif
   #ifdef RLIMIT_NPROC
       if (conf->limit_nproc != NULL)
        if ((setrlimit (RLIMIT_NPROC, conf->limit_nproc)) != 0)
  -         log_unixerr("setrlimit", NULL, "failed to set process limit",
  -                     r->server);
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "setrlimit: failed to set process limit");
   #endif
   #ifdef RLIMIT_DATA
       if (conf->limit_mem != NULL)
        if ((setrlimit (RLIMIT_DATA, conf->limit_mem)) != 0)
  -         log_unixerr("setrlimit", NULL, "failed to set memory usage limit",
  -                     r->server);
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "setrlimit: failed to set memory usage limit");
   #endif
   #ifdef RLIMIT_VMEM
       if (conf->limit_mem != NULL)
        if ((setrlimit (RLIMIT_VMEM, conf->limit_mem)) != 0)
  -         log_unixerr("setrlimit", NULL, "failed to set memory usage limit",
  -                     r->server);
  +         aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                     "setrlimit: failed to set memory usage limit");
   #endif
       
   #ifdef __EMX__    
  @@ -536,21 +537,20 @@
           program = fopen (r->filename, "r");
           if (!program) {
               char err_string[HUGE_STRING_LEN];
  -            ap_snprintf(err_string, sizeof(err_string), 
  -              "open of %s failed, reason: fopen: %s (errno = %d)\n", 
  -              r->filename, strerror(errno), errno);
  -
  +            ap_snprintf(err_string, sizeof(err_string),      "open of %s 
failed", r->filename);
  +         
               /* write(2, err_string, strlen(err_string)); */
               /* exit(0); */
  -            log_unixerr("fopen", NULL, err_string, r->server);
  +            aplog_error(APLOG_MARK, APLOG_ERR, r->server, "fopen: %s", 
err_string);
               return(pid);
           }
  -        fgets (interpreter, sizeof(interpreter), program);
  -        fclose (program);
  +        fgets(interpreter, sizeof(interpreter), program);
  +        fclose(program);
           if (!strncmp (interpreter, "#!", 2)) {
               is_script = 1;
               interpreter[strlen(interpreter)-1] = '\0';
  -        } else {
  +        }
  +     else {
               is_script = 0;
           }
   
  @@ -629,22 +629,24 @@
                   !strcasecmp(dot, ".COM"))
                   is_exe = 1;
           }
  -        if(!is_exe)
  -        {
  +     
  +        if (!is_exe) {
               program = fopen (r->filename, "rb");
               if (!program) {
                   char err_string[HUGE_STRING_LEN];
  -                ap_snprintf(err_string, sizeof(err_string), "open of %s 
failed, errno is %d\n", r->filename, errno);
  +                ap_snprintf(err_string, sizeof(err_string),
  +                         "open of %s failed", r->filename);
                   /* write(2, err_string, strlen(err_string)); */
                   /* exit(0); */
  -                log_unixerr("fopen", NULL, err_string, r->server);
  +                aplog_error(APLOG_MARK, APLOG_ERR, r->server, "fopen: %s", 
err_string);
                   return(pid);
               }
  -            sz = fread (interpreter, 1, sizeof(interpreter)-1, program);
  -            if(sz < 0) {
  +            sz = fread(interpreter, 1, sizeof(interpreter)-1, program);
  +            if (sz < 0) {
                   char err_string[HUGE_STRING_LEN];
  -                ap_snprintf(err_string, sizeof(err_string), "open of %s 
failed, errno is %d\n", r->filename, errno);
  -                log_unixerr("fread", NULL, err_string, r->server);
  +                ap_snprintf(err_string, sizeof(err_string),
  +                         "open of %s failed", r->filename);
  +                aplog_error(APLOG_MARK, APLOG_ERR, r->server, "fread: %s", 
err_string);
                   fclose(program);
                   return(pid);
               }
  @@ -720,7 +722,8 @@
            if (pos >= 0) username[pos] = '\0';
   
            if ((pw = getpwnam(username)) == NULL) {
  -             log_unixerr("getpwnam",username,"invalid username",r->server);
  +             aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                         "getpwnam: invalid username %s", username);
                return(pid);
            }
            execuser = pstrcat(r->pool, "~", pw->pw_name, NULL);
  @@ -737,13 +740,15 @@
        }
        else {
            if ((pw = getpwuid (r->server->server_uid)) == NULL) {
  -             log_unixerr("getpwuid", NULL, "invalid userid", r->server);
  +             aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                         "getpwuid: invalid userid %d", 
r->server->server_uid);
                return(pid);
            }
            execuser = pstrdup(r->pool, pw->pw_name);
   
            if ((gr = getgrgid (r->server->server_gid)) == NULL) {
  -             log_unixerr("getgrgid", NULL, "invalid groupid", r->server);
  +             aplog_error(APLOG_MARK, APLOG_ERR, r->server,
  +                         "getgrgid: invalid groupid %d", 
r->server->server_gid);
                return(pid);
            }
            grpname = gr->gr_name;
  
  
  

Reply via email to