socsvn commit: r222835 - in soc2011/gk/ino64-head/usr.sbin: cpucontrol newsyslog

gk at FreeBSD.org gk at FreeBSD.org
Sun Jun 5 16:19:10 UTC 2011


Author: gk
Date: Sun Jun  5 16:19:08 2011
New Revision: 222835
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=222835

Log:
  Avoid using dirfd name there is dirfd() macro already

Modified:
  soc2011/gk/ino64-head/usr.sbin/cpucontrol/cpucontrol.c
  soc2011/gk/ino64-head/usr.sbin/newsyslog/newsyslog.c

Modified: soc2011/gk/ino64-head/usr.sbin/cpucontrol/cpucontrol.c
==============================================================================
--- soc2011/gk/ino64-head/usr.sbin/cpucontrol/cpucontrol.c	Sun Jun  5 16:18:57 2011	(r222834)
+++ soc2011/gk/ino64-head/usr.sbin/cpucontrol/cpucontrol.c	Sun Jun  5 16:19:08 2011	(r222835)
@@ -290,7 +290,7 @@
 	int error;
 	struct ucode_handler *handler;
 	struct datadir *dir;
-	DIR *dirfd;
+	DIR *dirp;
 	struct dirent *direntry;
 	char buf[MAXPATHLEN];
 
@@ -319,12 +319,12 @@
 	 * Process every image in specified data directories.
 	 */
 	SLIST_FOREACH(dir, &datadirs, next) {
-		dirfd  = opendir(dir->path);
-		if (dirfd == NULL) {
+		dirp  = opendir(dir->path);
+		if (dirp == NULL) {
 			WARNX(1, "skipping directory %s: not accessible", dir->path);
 			continue;
 		}
-		while ((direntry = readdir(dirfd)) != NULL) {
+		while ((direntry = readdir(dirp)) != NULL) {
 			if (direntry->d_namlen == 0)
 				continue;
 			error = snprintf(buf, sizeof(buf), "%s/%s", dir->path,
@@ -338,7 +338,7 @@
 			}
 			handler->update(dev, buf);
 		}
-		error = closedir(dirfd);
+		error = closedir(dirp);
 		if (error != 0)
 			WARN(0, "closedir(%s)", dir->path);
 	}

Modified: soc2011/gk/ino64-head/usr.sbin/newsyslog/newsyslog.c
==============================================================================
--- soc2011/gk/ino64-head/usr.sbin/newsyslog/newsyslog.c	Sun Jun  5 16:18:57 2011	(r222834)
+++ soc2011/gk/ino64-head/usr.sbin/newsyslog/newsyslog.c	Sun Jun  5 16:19:08 2011	(r222835)
@@ -1448,7 +1448,7 @@
 delete_oldest_timelog(const struct conf_entry *ent, const char *archive_dir)
 {
 	char *logfname, *s, *dir, errbuf[80];
-	int dirfd, i, logcnt, max_logcnt, valid;
+	int dir_fd, i, logcnt, max_logcnt, valid;
 	struct oldlog_entry *oldlogs;
 	size_t logfname_len;
 	struct dirent *dp;
@@ -1483,7 +1483,7 @@
 	/* First we create a 'list' of all archived logfiles */
 	if ((dirp = opendir(dir)) == NULL)
 		err(1, "Cannot open log directory '%s'", dir);
-	dirfd = dirfd(dirp);
+	dir_fd = dirfd(dirp);
 	while ((dp = readdir(dirp)) != NULL) {
 		if (dp->d_type != DT_REG)
 			continue;
@@ -1575,7 +1575,7 @@
 			if (noaction)
 				printf("\trm -f %s/%s\n", dir,
 				    oldlogs[i].fname);
-			else if (unlinkat(dirfd, oldlogs[i].fname, 0) != 0) {
+			else if (unlinkat(dir_fd, oldlogs[i].fname, 0) != 0) {
 				snprintf(errbuf, sizeof(errbuf),
 				    "Could not delet old logfile '%s'",
 				    oldlogs[i].fname);


More information about the svn-soc-all mailing list