Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.sbin/chown Pull up revision 1.25 via patch (request...



details:   https://anonhg.NetBSD.org/src/rev/3374154fc615
branches:  netbsd-1-5
changeset: 490429:3374154fc615
user:      jhawk <jhawk%NetBSD.org@localhost>
date:      Tue Dec 26 01:57:54 2000 +0000

description:
Pull up revision 1.25 via patch (requested by mike):
  Correct the display of some errors in chown. Fixes PR#11695,

diffstat:

 usr.sbin/chown/chown.c |  27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)

diffs (72 lines):

diff -r 4f959e9c35b6 -r 3374154fc615 usr.sbin/chown/chown.c
--- a/usr.sbin/chown/chown.c    Tue Dec 26 01:44:59 2000 +0000
+++ b/usr.sbin/chown/chown.c    Tue Dec 26 01:57:54 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chown.c,v 1.21 2000/05/10 12:22:34 darrenr Exp $       */
+/*     $NetBSD: chown.c,v 1.21.4.1 2000/12/26 01:57:54 jhawk Exp $     */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)chown.c    8.8 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: chown.c,v 1.21 2000/05/10 12:22:34 darrenr Exp $");
+__RCSID("$NetBSD: chown.c,v 1.21.4.1 2000/12/26 01:57:54 jhawk Exp $");
 #endif
 #endif /* not lint */
 
@@ -64,7 +64,7 @@
 #include <unistd.h>
 
 static void    a_gid __P((const char *));
-static int     a_uid __P((const char *));
+static void    a_uid __P((const char *));
 static id_t    id __P((const char *, const char *));
        int     main __P((int, char **));
 static void    usage __P((void));
@@ -155,13 +155,13 @@
                } 
 #ifdef SUPPORT_DOT
                else if ((cp = strrchr(*argv, '.')) != NULL) {
-                       if (a_uid(*argv) == -1) {
+                       if (uid_from_user(*argv, &uid) == -1) {
                                *cp++ = '\0';
                                a_gid(cp);
                        }
                }
 #endif
-               (void) a_uid(*argv);
+               a_uid(*argv);
        } else 
                a_gid(*argv);
 
@@ -220,23 +220,16 @@
        gid = ((gr = getgrnam(s)) == NULL) ? id(s, "group") : gr->gr_gid;
 }
 
-static int
+static void
 a_uid(s)
        const char *s;
 {
-       struct passwd *pw;
-
        if (*s == '\0')                 /* Argument was "[:.]gid". */
-               return 0;
-       pw = getpwnam(s);
-       if (pw != NULL) {
-               uid = pw->pw_uid;
-               return 0;
+               return;
+       if (uid_from_user(s, &uid) == -1) {
+               uid = id(s, "user");
        }
-       if (isalpha(*s))
-               return -1;
-       uid = id(s, "user");
-       return 0;
+       return;
 }
 
 static id_t



Home | Main Index | Thread Index | Old Index