Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/mtree Remove convoluted code to work around missing...



details:   https://anonhg.NetBSD.org/src/rev/08b55eb1dd73
branches:  trunk
changeset: 537901:08b55eb1dd73
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Oct 08 00:34:08 2002 +0000

description:
Remove convoluted code to work around missing lch{flags,mod,own}();
instead, rely upon libnbcompat to provide a workaround (which returns
an error if the target is a symlink).
Should fix another MacOS X build issue due to missing lchown(2).

diffstat:

 usr.sbin/mtree/compare.c |  21 +++------------------
 usr.sbin/mtree/extern.h  |   4 +---
 usr.sbin/mtree/verify.c  |  12 ++----------
 3 files changed, 6 insertions(+), 31 deletions(-)

diffs (117 lines):

diff -r 42bd50112b9d -r 08b55eb1dd73 usr.sbin/mtree/compare.c
--- a/usr.sbin/mtree/compare.c  Tue Oct 08 00:28:36 2002 +0000
+++ b/usr.sbin/mtree/compare.c  Tue Oct 08 00:34:08 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compare.c,v 1.41 2002/10/06 01:36:09 lukem Exp $       */
+/*     $NetBSD: compare.c,v 1.42 2002/10/08 00:34:08 lukem Exp $       */
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)compare.c  8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: compare.c,v 1.41 2002/10/06 01:36:09 lukem Exp $");
+__RCSID("$NetBSD: compare.c,v 1.42 2002/10/08 00:34:08 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -79,15 +79,6 @@
 
 #if HAVE_STRUCT_STAT_ST_FLAGS
 
-#if HAVE_LCHFLAGS
-#define CHANGE_LCHFLAGS        if (lchflags(p->fts_accpath, flags))
-#else
-#define CHANGE_LCHFLAGS        if (S_ISLNK(p->fts_statp->st_mode)) {           \
-                               label++;                                \
-                               printf(                                 \
-                                   ", not modified: no lchflags call)\n"); \
-                       } else if (chflags(p->fts_accpath, flags))
-#endif
 
 #define CHANGEFLAGS                                                    \
        if (flags != p->fts_statp->st_flags) {                          \
@@ -96,7 +87,7 @@
                        printf("%sflags (\"%s\"", tab,                  \
                            flags_to_string(p->fts_statp->st_flags, "none")); \
                }                                                       \
-               CHANGE_LCHFLAGS {                                       \
+               if (lchflags(p->fts_accpath, flags)) {                  \
                        label++;                                        \
                        printf(", not modified: %s)\n",                 \
                            strerror(errno));                           \
@@ -260,13 +251,7 @@
                    tab, (u_long)s->st_mode,
                    (u_long)p->fts_statp->st_mode & MBITS);
                if (uflag) {
-#if HAVE_LCHMOD
                        if (lchmod(p->fts_accpath, s->st_mode))
-#else
-                       if (S_ISLNK(p->fts_statp->st_mode))
-                               printf(", not modified: no lchmod call\n");
-                       else if (chmod(p->fts_accpath, s->st_mode))
-#endif
                                printf(", not modified: %s)\n",
                                    strerror(errno));
                        else
diff -r 42bd50112b9d -r 08b55eb1dd73 usr.sbin/mtree/extern.h
--- a/usr.sbin/mtree/extern.h   Tue Oct 08 00:28:36 2002 +0000
+++ b/usr.sbin/mtree/extern.h   Tue Oct 08 00:34:08 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.24 2002/10/06 01:36:09 lukem Exp $        */
+/*     $NetBSD: extern.h,v 1.25 2002/10/08 00:34:08 lukem Exp $        */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -40,8 +40,6 @@
 #if HAVE_CONFIG_H
 #include "config.h" 
 #else 
-#define HAVE_LCHFLAGS 1
-#define HAVE_LCHMOD 1
 #define HAVE_STRUCT_STAT_ST_FLAGS 1
 #endif
  
diff -r 42bd50112b9d -r 08b55eb1dd73 usr.sbin/mtree/verify.c
--- a/usr.sbin/mtree/verify.c   Tue Oct 08 00:28:36 2002 +0000
+++ b/usr.sbin/mtree/verify.c   Tue Oct 08 00:34:08 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: verify.c,v 1.31 2002/10/06 01:36:09 lukem Exp $        */
+/*     $NetBSD: verify.c,v 1.32 2002/10/08 00:34:08 lukem Exp $        */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)verify.c   8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: verify.c,v 1.31 2002/10/06 01:36:09 lukem Exp $");
+__RCSID("$NetBSD: verify.c,v 1.32 2002/10/08 00:34:08 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -270,11 +270,7 @@
                        continue;
                }
                if (p->flags & F_MODE) {
-#if HAVE_LCHMOD
                        if (lchmod(path, p->st_mode))
-#else
-                       if ((p->type != F_LINK) && chmod(path, p->st_mode))
-#endif
                                printf("%s: permissions not set: %s\n",
                                    path, strerror(errno));
                }
@@ -284,11 +280,7 @@
                                flags = p->st_flags;
                        else
                                flags = p->st_flags & ~SP_FLGS;
-#if HAVE_LCHFLAGS
                        if (lchflags(path, flags))
-#else
-                       if ((p->type != F_LINK) && chflags(path, flags))
-#endif
                                printf("%s: file flags not set: %s\n",
                                    path, strerror(errno));
                }



Home | Main Index | Thread Index | Old Index