summaryrefslogtreecommitdiffstats
path: root/chpass/field.c
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>2004-01-18 21:46:39 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>2004-01-18 21:46:39 +0000
commit73461538c2a564f3992725609929618b698e9701 (patch)
treeaec4e4cec78802852b4e042295d2c69dc8a9384d /chpass/field.c
parentcae6d992ea1343a8e952c86544cb57eb32a1788d (diff)
downloadpw-darwin-73461538c2a564f3992725609929618b698e9701.tar.gz
pw-darwin-73461538c2a564f3992725609929618b698e9701.tar.zst
pw-darwin-73461538c2a564f3992725609929618b698e9701.zip
Remove unused includes. Make it WARNS=6 friendly. Concerning bin/2442, make
a new function dup_shell() to replace ok_shell() and make it unconditionnally strdup() its result to make the caller's code simplier. Change ok_shell() to just return an integer value suitable for tests (it was used mainly for that purpose). Do not use strdup() in the caller's code but rely on dup_shell() that will do the job for us. PR: bin/2442
Diffstat (limited to 'chpass/field.c')
-rw-r--r--chpass/field.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/chpass/field.c b/chpass/field.c
index fe5b30f..eac5561 100644
--- a/chpass/field.c
+++ b/chpass/field.c
@@ -56,10 +56,8 @@ __FBSDID("$FreeBSD$");
#include <grp.h>
#include <paths.h>
#include <pwd.h>
-#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include "chpass.h"
@@ -218,7 +216,6 @@ p_hdir(char *p, struct passwd *pw, ENTRY *ep __unused)
int
p_shell(char *p, struct passwd *pw, ENTRY *ep __unused)
{
- char *t;
struct stat sbuf;
if (!*p) {
@@ -230,15 +227,16 @@ p_shell(char *p, struct passwd *pw, ENTRY *ep __unused)
warnx("%s: current shell non-standard", pw->pw_shell);
return (-1);
}
- if (!(t = ok_shell(p))) {
+ if (!ok_shell(p)) {
if (!master_mode) {
warnx("%s: non-standard shell", p);
return (-1);
}
+ pw->pw_shell = strdup(p);
}
else
- p = t;
- if (!(pw->pw_shell = strdup(p))) {
+ pw->pw_shell = dup_shell(p);
+ if (!pw->pw_shell) {
warnx("can't save entry");
return (-1);
}