summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2004-03-14 22:53:19 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2004-03-14 22:53:19 +0000
commit22758970e5a8fd6832d2bbb9f69a129ada799762 (patch)
tree7e7b268734f7921eaa8c93f3cf1df5969ec4da6d
parent555a2250638146792f70ed607cd466e449481d6a (diff)
use pid_t for fork return. started by Joris Vink
-rw-r--r--usr.bin/passwd/pwd_check.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/passwd/pwd_check.c b/usr.bin/passwd/pwd_check.c
index 317996dca6c..58c42e4f53b 100644
--- a/usr.bin/passwd/pwd_check.c
+++ b/usr.bin/passwd/pwd_check.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd_check.c,v 1.6 2002/06/28 22:28:17 deraadt Exp $ */
+/* $OpenBSD: pwd_check.c,v 1.7 2004/03/14 22:53:18 tedu Exp $ */
/*
* Copyright 2000 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -87,6 +87,7 @@ pwd_check(struct passwd *pwd, login_cap_t *lc, char *password)
int i, res, min_len;
char *cp, option[LINE_MAX];
int pipefds[2];
+ pid_t child;
min_len = (int) login_getcapnum(lc, "minpasswordlen", 6, 6);
if (min_len > 0 && strlen(password) < min_len) {
@@ -150,8 +151,8 @@ pwd_check(struct passwd *pwd, login_cap_t *lc, char *password)
goto out;
}
- res = fork();
- if (res == 0) {
+ child = fork();
+ if (child == 0) {
char *argp[] = { "sh", "-c", NULL, NULL};
/* Drop privileges */
@@ -168,7 +169,7 @@ pwd_check(struct passwd *pwd, login_cap_t *lc, char *password)
if (execv(_PATH_BSHELL, argp) == -1)
exit(1);
/* NOT REACHED */
- } else if (res == -1) {
+ } else if (child == -1) {
warn("fork");
goto out;
}
@@ -179,8 +180,8 @@ pwd_check(struct passwd *pwd, login_cap_t *lc, char *password)
close(pipefds[1]);
/* get the return value from the child */
- wait(&res);
- if (WIFEXITED(res) && WEXITSTATUS(res) == 0)
+ wait(&child);
+ if (WIFEXITED(child) && WEXITSTATUS(child) == 0)
return (1);
out:
@@ -190,7 +191,7 @@ pwd_check(struct passwd *pwd, login_cap_t *lc, char *password)
}
int
-pwd_gettries( struct passwd *pwd, login_cap_t *lc )
+pwd_gettries(struct passwd *pwd, login_cap_t *lc)
{
char option[LINE_MAX];
char *ep = option;