summaryrefslogtreecommitdiffstats
path: root/chpass/field.c
diff options
context:
space:
mode:
authorDavid Malone <dwmalone@FreeBSD.org>2002-03-30 13:44:45 +0000
committerDavid Malone <dwmalone@FreeBSD.org>2002-03-30 13:44:45 +0000
commitb719e49da943cac32d2d31c602e8e34585df4605 (patch)
tree51aa80b2fbdafa59664605b1d37b10b3941bcc2a /chpass/field.c
parent04d1b23be991cae809ac39645d9ac7341ec74885 (diff)
downloadpw-darwin-b719e49da943cac32d2d31c602e8e34585df4605.tar.gz
pw-darwin-b719e49da943cac32d2d31c602e8e34585df4605.tar.zst
pw-darwin-b719e49da943cac32d2d31c602e8e34585df4605.zip
Minor post warns stuff.
1) Fix up vendor IDs for files I'm touching and put FBSDID in the right place. 2) Cast return value of snprintf to size_t rather than casting sizeof() to an int, 'cos we know snprintf returns a non-genative number. 3) Avoid 'char *blank = "";' by just strduping. This could be bad sometimes, but all these variables usually point at malloced memory so this makes them always point at malloced memory.
Diffstat (limited to 'chpass/field.c')
-rw-r--r--chpass/field.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/chpass/field.c b/chpass/field.c
index 264cf08..0e2770b 100644
--- a/chpass/field.c
+++ b/chpass/field.c
@@ -31,9 +31,11 @@
* SUCH DAMAGE.
*/
+#if 0
#ifndef lint
-static const char sccsid[] = "@(#)field.c 8.4 (Berkeley) 4/2/94";
+static char sccsid[] = "@(#)field.c 8.4 (Berkeley) 4/2/94";
#endif /* not lint */
+#endif
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -54,8 +56,6 @@ __FBSDID("$FreeBSD$");
#include "chpass.h"
#include "pathnames.h"
-static char blank[] = "";
-
/* ARGSUSED */
int
p_login(char *p, struct passwd *pw, ENTRY *ep __unused)
@@ -86,9 +86,7 @@ p_login(char *p, struct passwd *pw, ENTRY *ep __unused)
int
p_passwd(char *p, struct passwd *pw, ENTRY *ep __unused)
{
- if (!*p)
- pw->pw_passwd = blank; /* "NOLOGIN"; */
- else if (!(pw->pw_passwd = strdup(p))) {
+ if (!(pw->pw_passwd = strdup(p))) {
warnx("can't save password entry");
return (1);
}
@@ -155,9 +153,7 @@ p_gid(char *p, struct passwd *pw, ENTRY *ep __unused)
int
p_class(char *p, struct passwd *pw, ENTRY *ep __unused)
{
- if (!*p)
- pw->pw_class = blank;
- else if (!(pw->pw_class = strdup(p))) {
+ if (!(pw->pw_class = strdup(p))) {
warnx("can't save entry");
return (1);
}
@@ -189,9 +185,7 @@ p_expire(char *p, struct passwd *pw, ENTRY *ep __unused)
int
p_gecos(char *p, struct passwd *pw __unused, ENTRY *ep __unused)
{
- if (!*p)
- ep->save = blank;
- else if (!(ep->save = strdup(p))) {
+ if (!(ep->save = strdup(p))) {
warnx("can't save entry");
return (1);
}