diff options
Diffstat (limited to 'src/userspec.c')
-rw-r--r-- | src/userspec.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/userspec.c b/src/userspec.c index c426acd81bda..d9be4f43570d 100644 --- a/src/userspec.c +++ b/src/userspec.c @@ -1,5 +1,6 @@ /* userspec.c -- Parse a user and group string. - Copyright (C) 1989, 1990, 1991, 1992, 2001, 2004 Free Software Foundation, Inc. + Copyright (C) 1989, 1990, 1991, 1992, 2001, + 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -11,9 +12,10 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public + License along with this program; if not, write to the Free + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301 USA. */ /* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */ @@ -72,7 +74,7 @@ extern struct group *getgrgid (gid_t gid); otherwise return 0. */ static int -isnumber (const char *str) +isnumber_p (const char *str) { for (; *str; str++) if (!isdigit (*str)) @@ -111,9 +113,9 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid, V_STRDUP (spec, spec_arg); /* Find the separator if there is one. */ - separator = index (spec, ':'); + separator = strchr (spec, ':'); if (separator == NULL) - separator = index (spec, '.'); + separator = strchr (spec, '.'); /* Replace separator with a NUL. */ if (separator != NULL) @@ -136,7 +138,7 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid, if (pwd == NULL) { - if (!isnumber (u)) + if (!isnumber_p (u)) error_msg = _("invalid user"); else { @@ -182,7 +184,7 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid, grp = getgrnam (g); if (grp == NULL) { - if (!isnumber (g)) + if (!isnumber_p (g)) error_msg = _("invalid group"); else *gid = atoi (g); |