diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 2000-09-20 04:43:13 +0000 |
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 2000-09-20 04:43:13 +0000 |
| commit | 6c05034cbe3599f937d2eb692f2bb7358e745052 (patch) | |
| tree | 8cb1c355b25faf8d862dd80b287817641206f347 /lib/libc/rpc/getpublickey.c | |
| parent | ace4f3086617e9b6efcfb61e97491ec16cfbb8cd (diff) | |
Notes
Diffstat (limited to 'lib/libc/rpc/getpublickey.c')
| -rw-r--r-- | lib/libc/rpc/getpublickey.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/libc/rpc/getpublickey.c b/lib/libc/rpc/getpublickey.c index e1c34d9b25eb..49227b41b5f4 100644 --- a/lib/libc/rpc/getpublickey.c +++ b/lib/libc/rpc/getpublickey.c @@ -26,6 +26,8 @@ * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 + * + * $FreeBSD$ */ #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = "@(#)publickey.c 1.10 91/03/11 Copyr 1986 Sun Micro"; @@ -97,11 +99,11 @@ getpublicandprivatekey(key, ret) char *mval; fd = fopen(PKFILE, "r"); - if (fd == (FILE *) 0) + if (fd == NULL) return (0); for (;;) { - res = fgets(buf, 1024, fd); - if (res == 0) { + res = fgets(buf, sizeof(buf), fd); + if (res == NULL) { fclose(fd); return (0); } @@ -140,13 +142,15 @@ getpublicandprivatekey(key, ret) continue; #endif /* YP */ } else { - mkey = strtok(buf, "\t "); + mkey = strsep(&res, "\t "); if (mkey == NULL) { fprintf(stderr, "Bad record in %s -- %s", PKFILE, buf); continue; } - mval = strtok((char *)NULL, " \t#\n"); + do { + mval = strsep(&res, " \t#\n"); + } while (mval != NULL && !*mval); if (mval == NULL) { fprintf(stderr, "Bad record in %s val problem - %s", PKFILE, buf); |
