]> granicus.if.org Git - apache/commitdiff
Update a couple of modules to use ap_stat() rather than stat().
authorBill Stoddard <stoddard@apache.org>
Tue, 16 May 2000 20:19:29 +0000 (20:19 +0000)
committerBill Stoddard <stoddard@apache.org>
Tue, 16 May 2000 20:19:29 +0000 (20:19 +0000)
PR:
Obtained from:
Submitted by:
Reviewed by:

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85232 13f79535-47bb-0310-9956-ffa450edef68

modules/filters/mod_include.c
modules/generators/mod_cgi.c

index b702f599be76465a24a0f14e386e6dacfc5cdbff..2c9d67d5a5ceedca527902df562838b7c0da9a8e 100644 (file)
@@ -1129,7 +1129,7 @@ static int find_file(request_rec *r, const char *directive, const char *tag,
 
         if (rr->status == HTTP_OK && rr->finfo.protection != 0) {
             memcpy((char *) finfo, (const char *) &rr->finfo,
-                   sizeof(struct stat));
+                   sizeof(rr->finfo));
             ap_destroy_sub_req(rr);
             return 0;
         }
index 6f14a7ab2cf6aa4fb9e444d27c269c6197b7069d..270e8f67afcaca8eddba660ff0f8632b09c52053 100644 (file)
@@ -175,15 +175,15 @@ static int log_scripterror(request_rec *r, cgi_server_conf * conf, int ret,
                           int show_errno, char *error)
 {
     ap_file_t *f = NULL;
-    struct stat finfo;
+    ap_finfo_t finfo;
     char time_str[AP_CTIME_LEN];
 
     ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, errno, r, 
                "%s: %s", error, r->filename);
 
     if (!conf->logname ||
-       ((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0)
-        &&   (finfo.st_size > conf->logbytes)) ||
+        ((ap_stat(&finfo, ap_server_root_relative(r->pool, conf->logname), r->pool) == APR_SUCCESS)
+         &&  (finfo.size > conf->logbytes)) ||
           (ap_open(&f, ap_server_root_relative(r->pool, conf->logname),
                    APR_APPEND, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) {
        return ret;
@@ -210,12 +210,12 @@ static int log_script(request_rec *r, cgi_server_conf * conf, int ret,
     char argsbuffer[HUGE_STRING_LEN];
     ap_file_t *f = NULL;
     int i;
-    struct stat finfo;
+    ap_finfo_t finfo;
     char time_str[AP_CTIME_LEN];
 
     if (!conf->logname ||
-       ((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0)
-        &&   (finfo.st_size > conf->logbytes)) ||
+        ((ap_stat(&finfo, ap_server_root_relative(r->pool, conf->logname), r->pool) == APR_SUCCESS)
+         &&  (finfo.size > conf->logbytes)) ||
          (ap_open(&f, ap_server_root_relative(r->pool, conf->logname),
                   APR_APPEND, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) {
        /* Soak up script output */
@@ -494,12 +494,12 @@ static int cgi_handler(request_rec *r)
 #if defined(OS2) || defined(WIN32)
     /* Allow for cgi files without the .EXE extension on them under OS/2 */
     if (r->finfo.protection == 0) {
-        struct stat statbuf;
+        ap_finfo_t finfo;
         char *newfile;
 
         newfile = ap_pstrcat(r->pool, r->filename, ".EXE", NULL);
-
-        if ((stat(newfile, &statbuf) != 0) || (!S_ISREG(statbuf.st_mode))) {
+        if ((ap_stat(&finfo, newfile, r->pool) != APR_SUCCESS) || 
+            (finfo.filetype != APR_REG)) {
             return log_scripterror(r, conf, NOT_FOUND, 0,
                                    "script not found or unable to stat");
         } else {