]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Win32: Set errno to ENAMETOOLONG when os_stat() returns -1.
authorBill Stoddard <stoddard@apache.org>
Wed, 26 Sep 2001 14:41:11 +0000 (14:41 +0000)
committerBill Stoddard <stoddard@apache.org>
Wed, 26 Sep 2001 14:41:11 +0000 (14:41 +0000)
This will fix problem where Apache on Windows can return a directory index when
it should return a negotiated file.  read_types_multi() iterates over
the entries in a directory to build a candidate list of
files to negotiate.  ap_sub_req_lookup_file() is called for each file
which in turn calls stat() (os_stat() on Windows) to verify the file exists.
mod_negotiation will decline the request (rather than failing the
request as it should) if os_stat() fails and errno is not set.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@91150 13f79535-47bb-0310-9956-ffa450edef68

src/os/win32/os.c

index f8edde19eb5dccd05b91da852bd4040a98b73293..87e5a64207731b60d2f4193d7d296fb177261d45 100755 (executable)
@@ -65,6 +65,7 @@
 #include <stdio.h>
 #include <time.h>
 #include "os.h"
+#include "errno.h"
 
 /* Win95 doesn't like trailing /s. NT and Unix don't mind. This works 
  * around the problem.
@@ -81,6 +82,7 @@ API_EXPORT(int) os_stat(const char *szPath, struct stat *pStat)
     int len = strlen(szPath);
     
     if ((len == 0) || (len >= MAX_PATH)) {
+        errno = ENAMETOOLONG;
         return -1;
     }
 
@@ -99,6 +101,7 @@ API_EXPORT(int) os_stat(const char *szPath, struct stat *pStat)
        /* then we need to add one more to get \\machine\share\ */
        if (nSlashes == 3) {
             if (++len >= MAX_PATH) {
+                errno = ENAMETOOLONG;
                 return -1;
             }
            *s++ = '\\';