Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 May 2015 21:44:10 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r283841 - head/usr.sbin/pw
Message-ID:  <201505312144.t4VLiAM2005055@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sun May 31 21:44:09 2015
New Revision: 283841
URL: https://svnweb.freebsd.org/changeset/base/283841

Log:
  Cast -1 to uid_t and bump WARNING level to 3

Modified:
  head/usr.sbin/pw/Makefile
  head/usr.sbin/pw/pw_group.c
  head/usr.sbin/pw/pw_user.c

Modified: head/usr.sbin/pw/Makefile
==============================================================================
--- head/usr.sbin/pw/Makefile	Sun May 31 21:39:08 2015	(r283840)
+++ head/usr.sbin/pw/Makefile	Sun May 31 21:44:09 2015	(r283841)
@@ -6,7 +6,7 @@ SRCS=	pw.c pw_conf.c pw_user.c pw_group.
 	grupd.c pwupd.c fileupd.c psdate.c \
 	bitmap.c cpdir.c rm_r.c
 
-WARNS?=	2
+WARNS?=	3
 
 LIBADD=	crypt util sbuf
 

Modified: head/usr.sbin/pw/pw_group.c
==============================================================================
--- head/usr.sbin/pw/pw_group.c	Sun May 31 21:39:08 2015	(r283840)
+++ head/usr.sbin/pw/pw_group.c	Sun May 31 21:44:09 2015	(r283841)
@@ -116,7 +116,7 @@ pw_group(struct userconf * cnf, int mode
 				char	*fmems[1];
 				fmems[0] = NULL;
 				fakegroup.gr_name = a_name ? a_name->val : "nogroup";
-				fakegroup.gr_gid = a_gid ? (gid_t) atol(a_gid->val) : -1;
+				fakegroup.gr_gid = a_gid ? (gid_t) atol(a_gid->val) : (uid_t)-1;
 				fakegroup.gr_mem = fmems;
 				return print_group(&fakegroup, getarg(args, 'P') != NULL);
 			}

Modified: head/usr.sbin/pw/pw_user.c
==============================================================================
--- head/usr.sbin/pw/pw_user.c	Sun May 31 21:39:08 2015	(r283840)
+++ head/usr.sbin/pw/pw_user.c	Sun May 31 21:44:09 2015	(r283841)
@@ -335,7 +335,7 @@ pw_user(struct userconf * cnf, int mode,
 		if (pwd == NULL) {
 			if (mode == M_PRINT && getarg(args, 'F')) {
 				fakeuser.pw_name = a_name ? a_name->val : "nouser";
-				fakeuser.pw_uid = a_uid ? (uid_t) atol(a_uid->val) : -1;
+				fakeuser.pw_uid = a_uid ? (uid_t) atol(a_uid->val) : (uid_t) -1;
 				return print_user(&fakeuser,
 						  getarg(args, 'P') != NULL,
 						  getarg(args, '7') != NULL);
@@ -791,7 +791,7 @@ pw_user(struct userconf * cnf, int mode,
 	grp = GETGRGID(pwd->pw_gid);
 	pw_log(cnf, mode, W_USER, "%s(%ld):%s(%ld):%s:%s:%s",
 	       pwd->pw_name, (long) pwd->pw_uid,
-	    grp ? grp->gr_name : "unknown", (long) (grp ? grp->gr_gid : -1),
+	    grp ? grp->gr_name : "unknown", (long) (grp ? grp->gr_gid : (uid_t)-1),
 	       pwd->pw_gecos, pwd->pw_dir, pwd->pw_shell);
 
 	/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505312144.t4VLiAM2005055>