diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-08-02 09:46:52 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2014-08-02 09:46:52 +0000 |
commit | e8c545b173de44be2eb6372a5d0d8c6fe1f5669d (patch) | |
tree | c3113c6a8eea3f3e7325595526eb29de7ee6bba6 /usr.sbin | |
parent | 27f3b55bdc8cf6288615febb7ea01eff8c1e071c (diff) |
scandir(3)-based directory auto index didn't work on NFS because the
file system is not filling in d_type properly. Using st_mode from the
stat call fixes the problem, eg. S_ISDIR(st.st_mode) instead of
dp->d_type == DT_DIR. Pointed out by pelikan@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/httpd/server_file.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/httpd/server_file.c b/usr.sbin/httpd/server_file.c index 7084c9f3d77..f6fffd0e886 100644 --- a/usr.sbin/httpd/server_file.c +++ b/usr.sbin/httpd/server_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_file.c,v 1.22 2014/07/31 17:55:09 reyk Exp $ */ +/* $OpenBSD: server_file.c,v 1.23 2014/08/02 09:46:51 reyk Exp $ */ /* * Copyright (c) 2006 - 2014 Reyk Floeter <reyk@openbsd.org> @@ -277,14 +277,14 @@ server_file_index(struct httpd *env, struct client *clt) if (dp->d_name[0] == '.' && !(dp->d_name[1] == '.' && dp->d_name[2] == '\0')) { /* ignore hidden files starting with a dot */ - } else if (dp->d_type == DT_DIR) { + } else if (S_ISDIR(st.st_mode)) { namewidth -= 1; /* trailing slash */ if (evbuffer_add_printf(evb, "<a href=\"%s\">%s/</a>%*s%s%20s\n", dp->d_name, dp->d_name, MAX(namewidth, 0), " ", tmstr, "-") == -1) skip = 1; - } else if (dp->d_type == DT_REG) { + } else if (S_ISREG(st.st_mode)) { if (evbuffer_add_printf(evb, "<a href=\"%s\">%s</a>%*s%s%20llu\n", dp->d_name, dp->d_name, |