diff options
author | Ed Maste <emaste@FreeBSD.org> | 2017-05-15 17:57:09 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2017-05-15 17:57:09 +0000 |
commit | b47e69e69e7d68b18fe0f0064b1eabe2dc73465e (patch) | |
tree | ba5c1bc423f5e68475546d830cd9286cb7b7db48 | |
parent | cf5cedd78512db4977037e04d5011ae4f020204c (diff) |
Notes
-rw-r--r-- | lib/libc/gen/getusershell.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/gen/getusershell.c b/lib/libc/gen/getusershell.c index 56659709ba19..810a19af837c 100644 --- a/lib/libc/gen/getusershell.c +++ b/lib/libc/gen/getusershell.c @@ -115,8 +115,8 @@ _local_initshells(void *rv, void *cb_data, va_list ap) if ((fp = fopen(_PATH_SHELLS, "re")) == NULL) return NS_UNAVAIL; - cp = line; - while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) { + while (fgets(line, MAXPATHLEN + 1, fp) != NULL) { + cp = line; while (*cp != '#' && *cp != '/' && *cp != '\0') cp++; if (*cp == '#' || *cp == '\0') @@ -124,7 +124,7 @@ _local_initshells(void *rv, void *cb_data, va_list ap) sp = cp; while (!isspace(*cp) && *cp != '#' && *cp != '\0') cp++; - *cp++ = '\0'; + *cp = '\0'; sl_add(sl, strdup(sp)); } (void)fclose(fp); |