Funtion appropriately in the absence of a lchmod call on the host.

This commit is contained in:
tv 2002-02-08 18:15:12 +00:00
parent b3ddad6b4b
commit 3fdf5a9991
3 changed files with 21 additions and 8 deletions

View File

@ -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 @@ compare(NODE *s, FTSENT *p)
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

View File

@ -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

View File

@ -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 @@ miss(NODE *p, char *tail)
(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)