Module Name:    src
Committed By:   mrg
Date:           Thu Aug 27 17:12:18 UTC 2015

Modified Files:
        src/libexec/httpd: dir-index-bozo.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/libexec/httpd/dir-index-bozo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/dir-index-bozo.c
diff -u src/libexec/httpd/dir-index-bozo.c:1.20 src/libexec/httpd/dir-index-bozo.c:1.21
--- src/libexec/httpd/dir-index-bozo.c:1.20	Fri Oct 10 05:10:59 2014
+++ src/libexec/httpd/dir-index-bozo.c	Thu Aug 27 17:12:18 2015
@@ -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 @@ directory_hr(bozohttpd_t *httpd)
  * 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 @@ bozo_dir_index(bozo_httpreq_t *request, 
 	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 @@ bozo_dir_index(bozo_httpreq_t *request, 
 	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 @@ bozo_dir_index(bozo_httpreq_t *request, 
 		     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;
 

Reply via email to