Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xinstall Don't assume that "id_t", "gid_t" and "uid_...



details:   https://anonhg.NetBSD.org/src/rev/c52f7cc31a14
branches:  trunk
changeset: 748972:c52f7cc31a14
user:      tron <tron%NetBSD.org@localhost>
date:      Thu Nov 12 10:10:49 2009 +0000

description:
Don't assume that "id_t", "gid_t" and "uid_t" use the same underlying type
and use the appropriate types instead. Tested under NetBSD 5.99.22
and Darwin 10.2.0.

This should fix one of the cross-builds under FreeBSD as reported by
Rhialto on the "current-users" mailing list.

diffstat:

 usr.bin/xinstall/xinstall.c |  23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)

diffs (54 lines):

diff -r aeac4723b730 -r c52f7cc31a14 usr.bin/xinstall/xinstall.c
--- a/usr.bin/xinstall/xinstall.c       Thu Nov 12 08:54:00 2009 +0000
+++ b/usr.bin/xinstall/xinstall.c       Thu Nov 12 10:10:49 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xinstall.c,v 1.113 2009/10/30 20:57:30 joerg Exp $     */
+/*     $NetBSD: xinstall.c,v 1.114 2009/11/12 10:10:49 tron Exp $      */
 
 /*
  * Copyright (c) 1987, 1993
@@ -46,7 +46,7 @@
 #if 0
 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
 #else
-__RCSID("$NetBSD: xinstall.c,v 1.113 2009/10/30 20:57:30 joerg Exp $");
+__RCSID("$NetBSD: xinstall.c,v 1.114 2009/11/12 10:10:49 tron Exp $");
 #endif
 #endif /* not lint */
 
@@ -88,7 +88,8 @@
 int    numberedbackup;
 int    mode = S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
 char   pathbuf[MAXPATHLEN];
-id_t   uid = -1, gid = -1;
+uid_t  uid = -1;
+gid_t  gid = -1;
 char   *group, *owner, *fflags, *tags;
 FILE   *metafp;
 char   *metafile;
@@ -312,13 +313,21 @@
 
        /* get group and owner id's */
        if (group && !dounpriv) {
-               if (gid_from_group(group, &gid) == -1 && ! parseid(group, &gid))
-                       errx(1, "unknown group %s", group);
+               if (gid_from_group(group, &gid) == -1) {
+                       id_t id;
+                       if (!parseid(group, &id))
+                               errx(1, "unknown group %s", group);
+                       gid = id;
+               }
                iflags |= HASGID;
        }
        if (owner && !dounpriv) {
-               if (uid_from_user(owner, &uid) == -1 && ! parseid(owner, &uid))
-                       errx(1, "unknown user %s", owner);
+               if (uid_from_user(owner, &uid) == -1) {
+                       id_t id;
+                       if (!parseid(owner, &id))
+                               errx(1, "unknown user %s", owner);
+                       uid = id;
+               }
                iflags |= HASUID;
        }
 



Home | Main Index | Thread Index | Old Index