Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/mtree Funtion appropriately in the absence of a lch...
details: https://anonhg.NetBSD.org/src/rev/682ca2fa5bb6
branches: trunk
changeset: 521931:682ca2fa5bb6
user: tv <tv%NetBSD.org@localhost>
date: Fri Feb 08 18:15:12 2002 +0000
description:
Funtion appropriately in the absence of a lchmod call on the host.
diffstat:
usr.sbin/mtree/compare.c | 10 ++++++++--
usr.sbin/mtree/extern.h | 3 ++-
usr.sbin/mtree/verify.c | 16 +++++++++++-----
3 files changed, 21 insertions(+), 8 deletions(-)
diffs (86 lines):
diff -r 461d3e30fbd1 -r 682ca2fa5bb6 usr.sbin/mtree/compare.c
--- a/usr.sbin/mtree/compare.c Fri Feb 08 17:48:38 2002 +0000
+++ b/usr.sbin/mtree/compare.c Fri Feb 08 18:15:12 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compare.c,v 1.39 2002/02/04 07:17:14 lukem Exp $ */
+/* $NetBSD: compare.c,v 1.40 2002/02/08 18:15:12 tv 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.39 2002/02/04 07:17:14 lukem Exp $");
+__RCSID("$NetBSD: compare.c,v 1.40 2002/02/08 18:15:12 tv Exp $");
#endif
#endif /* not lint */
@@ -253,7 +253,13 @@
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 461d3e30fbd1 -r 682ca2fa5bb6 usr.sbin/mtree/extern.h
--- a/usr.sbin/mtree/extern.h Fri Feb 08 17:48:38 2002 +0000
+++ b/usr.sbin/mtree/extern.h Fri Feb 08 18:15:12 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.22 2002/01/31 22:44:05 tv Exp $ */
+/* $NetBSD: extern.h,v 1.23 2002/02/08 18:15:12 tv Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -40,6 +40,7 @@
#if HAVE_CONFIG_H
#include "config.h"
#else
+#define HAVE_LCHMOD 1
#define HAVE_STRUCT_STAT_ST_FLAGS 1
#endif
diff -r 461d3e30fbd1 -r 682ca2fa5bb6 usr.sbin/mtree/verify.c
--- a/usr.sbin/mtree/verify.c Fri Feb 08 17:48:38 2002 +0000
+++ b/usr.sbin/mtree/verify.c Fri Feb 08 18:15:12 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: verify.c,v 1.29 2002/02/04 07:17:14 lukem Exp $ */
+/* $NetBSD: verify.c,v 1.30 2002/02/08 18:15:12 tv 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.29 2002/02/04 07:17:14 lukem Exp $");
+__RCSID("$NetBSD: verify.c,v 1.30 2002/02/08 18:15:12 tv Exp $");
#endif
#endif /* not lint */
@@ -269,9 +269,15 @@
(p->flags & F_FLAGS) ? "and file flags " : "");
continue;
}
- if ((p->flags & F_MODE) && lchmod(path, p->st_mode))
- printf("%s: permissions not set: %s\n",
- path, strerror(errno));
+ 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));
+ }
#if HAVE_STRUCT_STAT_ST_FLAGS
if ((p->flags & F_FLAGS) && p->st_flags) {
if (iflag)
Home |
Main Index |
Thread Index |
Old Index