Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/httpd s/dirname/dirpath/ to avoid potentially shadow...



details:   https://anonhg.NetBSD.org/src/rev/f2b318697587
branches:  trunk
changeset: 340213:f2b318697587
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Aug 27 17:12:18 2015 +0000

description:
s/dirname/dirpath/ to avoid potentially shadowing dirname(3).

diffstat:

 libexec/httpd/dir-index-bozo.c |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (61 lines):

diff -r 1507397d30c5 -r f2b318697587 libexec/httpd/dir-index-bozo.c
--- a/libexec/httpd/dir-index-bozo.c    Thu Aug 27 14:17:14 2015 +0000
+++ b/libexec/httpd/dir-index-bozo.c    Thu Aug 27 17:12:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir-index-bozo.c,v 1.20 2014/10/10 05:10:59 mrg Exp $  */
+/*     $NetBSD: dir-index-bozo.c,v 1.21 2015/08/27 17:12:18 mrg Exp $  */
 
 /*     $eterna: dir-index-bozo.c,v 1.20 2011/11/18 09:21:15 mrg Exp $  */
 
@@ -57,7 +57,7 @@
  * output a directory index.  return 1 if it actually did something..
  */
 int
-bozo_dir_index(bozo_httpreq_t *request, const char *dirname, int isindex)
+bozo_dir_index(bozo_httpreq_t *request, const char *dirpath, int isindex)
 {
        bozohttpd_t *httpd = request->hr_httpd;
        struct stat sb;
@@ -72,17 +72,17 @@
        if (!isindex || !httpd->dir_indexing)
                return 0;
 
-       if (strlen(dirname) <= strlen(httpd->index_html))
-               dirname = ".";
+       if (strlen(dirpath) <= strlen(httpd->index_html))
+               dirpath = ".";
        else {
-               file = bozostrdup(httpd, dirname);
+               file = bozostrdup(httpd, dirpath);
 
                file[strlen(file) - strlen(httpd->index_html)] = '\0';
-               dirname = file;
+               dirpath = file;
        }
-       debug((httpd, DEBUG_FAT, "bozo_dir_index: dirname ``%s''", dirname));
-       if (stat(dirname, &sb) < 0 ||
-           (dp = opendir(dirname)) == NULL) {
+       debug((httpd, DEBUG_FAT, "bozo_dir_index: dirpath ``%s''", dirpath));
+       if (stat(dirpath, &sb) < 0 ||
+           (dp = opendir(dirpath)) == NULL) {
                if (errno == EPERM)
                        (void)bozo_http_error(httpd, 403, request,
                            "no permission to open directory");
@@ -123,7 +123,7 @@
        directory_hr(httpd);
        bozo_printf(httpd, "<pre>");
 
-       for (j = k = scandir(dirname, &de, NULL, alphasort), deo = de;
+       for (j = k = scandir(dirpath, &de, NULL, alphasort), deo = de;
            j--; de++) {
                int nostat = 0;
                char *name = (*de)->d_name;
@@ -134,7 +134,7 @@
                     httpd->hide_dots && name[0] == '.'))
                        continue;
 
-               snprintf(buf, sizeof buf, "%s/%s", dirname, name);
+               snprintf(buf, sizeof buf, "%s/%s", dirpath, name);
                if (stat(buf, &sb))
                        nostat = 1;
 



Home | Main Index | Thread Index | Old Index