Module Name:    src
Committed By:   dholland
Date:           Sun Jul 10 07:54:49 UTC 2011

Modified Files:
        src/usr.sbin/edquota: edquota.c pathnames.h

Log Message:
Minor cosmetic fixes, no semantic changes. (object file diffs have been
checked)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/edquota/edquota.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/edquota/pathnames.h

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

Modified files:

Index: src/usr.sbin/edquota/edquota.c
diff -u src/usr.sbin/edquota/edquota.c:1.34 src/usr.sbin/edquota/edquota.c:1.35
--- src/usr.sbin/edquota/edquota.c:1.34	Sun Jul 10 07:31:48 2011
+++ src/usr.sbin/edquota/edquota.c	Sun Jul 10 07:54:49 2011
@@ -1,4 +1,4 @@
-/*      $NetBSD: edquota.c,v 1.34 2011/07/10 07:31:48 dholland Exp $ */
+/*      $NetBSD: edquota.c,v 1.35 2011/07/10 07:54:49 dholland Exp $ */
 /*
  * Copyright (c) 1980, 1990, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "from: @(#)edquota.c	8.3 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: edquota.c,v 1.34 2011/07/10 07:31:48 dholland Exp $");
+__RCSID("$NetBSD: edquota.c,v 1.35 2011/07/10 07:54:49 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -81,7 +81,7 @@
 #include "pathnames.h"
 
 static const char *quotagroup = QUOTAGROUP;
-static char tmpfil[] = _PATH_TMP;
+static char tmpfil[] = _PATH_TMPFILE;
 
 struct quotause {
 	struct	quotause *next;
@@ -97,7 +97,6 @@
 #define MAX_TMPSTR	(100+MAXPATHLEN)
 
 static void	usage(void) __dead;
-static int	getentry(const char *, int);
 static struct quotause * getprivs(long, int, const char *, int);
 static struct quotause * getprivs2(long, int, const char *, int);
 static struct quotause * getprivs1(long, int, const char *);
@@ -107,7 +106,6 @@
 static int	editit(const char *);
 static int	writeprivs(struct quotause *, int, const char *, int);
 static int	readprivs(struct quotause *, int);
-static void	freeq(struct quotause *);
 static void	freeprivs(struct quotause *);
 static void clearpriv(int, char **, const char *, int);
 
@@ -123,12 +121,12 @@
 // support code
 
 /*
- * This routine converts a name for a particular quota type to
+ * This routine converts a name for a particular quota class to
  * an identifier. This routine must agree with the kernel routine
- * getinoquota as to the interpretation of quota types.
+ * getinoquota as to the interpretation of quota classes.
  */
 static int
-getentry(const char *name, int quotaclass)
+getidbyname(const char *name, int quotaclass)
 {
 	struct passwd *pw;
 	struct group *gr;
@@ -161,7 +159,7 @@
  * Free a quotause structure.
  */
 static void
-freeq(struct quotause *qup)
+quotause_destroy(struct quotause *qup)
 {
 	free(qup->qfname);
 	free(qup);
@@ -177,7 +175,7 @@
 
 	for (qup = quplist; qup; qup = nextqup) {
 		nextqup = qup->next;
-		freeq(qup);
+		quotause_destroy(qup);
 	}
 }
 
@@ -236,13 +234,13 @@
 		fd = open(qfpathname, O_RDWR|O_CREAT, 0640);
 		if (fd < 0 && errno != ENOENT) {
 			warnx("open `%s'", qfpathname);
-			freeq(qup);
+			quotause_destroy(qup);
 			return NULL;
 		}
 		warnx("Creating quota file %s", qfpathname);
 		sleep(3);
 		(void)fchown(fd, getuid(),
-		    getentry(quotagroup, QUOTA_CLASS_GROUP));
+		    getidbyname(quotagroup, QUOTA_CLASS_GROUP));
 		(void)fchmod(fd, 0640);
 	}
 	(void)lseek(fd, (off_t)(id * sizeof(struct dqblk)),
@@ -262,7 +260,7 @@
 	default:		/* ERROR */
 		warn("read error in `%s'", qfpathname);
 		close(fd);
-		freeq(qup);
+		quotause_destroy(qup);
 		return NULL;
 	}
 	close(fd);
@@ -470,7 +468,7 @@
 	}
 
 	for ( ; argc > 0; argc--, argv++) {
-		if ((id = getentry(*argv, quotaclass)) == -1)
+		if ((id = getidbyname(*argv, quotaclass)) == -1)
 			continue;
 		data = prop_dictionary_create();
 		if (data == NULL)
@@ -996,7 +994,7 @@
 	if (pflag) {
 		if (soft || hard || grace || dflag || cflag)
 			usage();
-		if ((protoid = getentry(protoname, quotaclass)) == -1)
+		if ((protoid = getidbyname(protoname, quotaclass)) == -1)
 			return 1;
 		protoprivs = getprivs(protoid, quotaclass, fs, 0);
 		for (qup = protoprivs; qup; qup = qup->next) {
@@ -1004,7 +1002,7 @@
 			qup->qe[QL_FL].ufsqe_time = 0;
 		}
 		while (argc-- > 0) {
-			if ((id = getentry(*argv++, quotaclass)) < 0)
+			if ((id = getidbyname(*argv++, quotaclass)) < 0)
 				continue;
 			putprivs(id, quotaclass, protoprivs);
 		}
@@ -1070,7 +1068,7 @@
 			return 0;
 		}
 		for ( ; argc > 0; argc--, argv++) {
-			if ((id = getentry(*argv, quotaclass)) == -1)
+			if ((id = getidbyname(*argv, quotaclass)) == -1)
 				continue;
 			curprivs = getprivs(id, quotaclass, fs, 0);
 			for (lqup = curprivs; lqup; lqup = lqup->next) {
@@ -1121,7 +1119,7 @@
 		freeprivs(curprivs);
 	}
 	for ( ; argc > 0; argc--, argv++) {
-		if ((id = getentry(*argv, quotaclass)) == -1)
+		if ((id = getidbyname(*argv, quotaclass)) == -1)
 			continue;
 		curprivs = getprivs(id, quotaclass, fs, 0);
 		if (writeprivs(curprivs, tmpfd, *argv, quotaclass) == 0)

Index: src/usr.sbin/edquota/pathnames.h
diff -u src/usr.sbin/edquota/pathnames.h:1.5 src/usr.sbin/edquota/pathnames.h:1.6
--- src/usr.sbin/edquota/pathnames.h:1.5	Thu Aug  7 11:25:21 2003
+++ src/usr.sbin/edquota/pathnames.h	Sun Jul 10 07:54:49 2011
@@ -27,10 +27,9 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)pathnames.h	8.1 (Berkeley) 6/6/93
- *	$NetBSD: pathnames.h,v 1.5 2003/08/07 11:25:21 agc Exp $
+ *	$NetBSD: pathnames.h,v 1.6 2011/07/10 07:54:49 dholland Exp $
  */
 
 #include <paths.h>
 
-#undef _PATH_TMP
-#define	_PATH_TMP	"/tmp/EdP.aXXXXX"
+#define	_PATH_TMPFILE	_PATH_TMP "EdP.aXXXXX"

Reply via email to