From 3f57bcbb36d92a16dbeb9efe7a7b00934cee7ab7 Mon Sep 17 00:00:00 2001 From: jlam Date: Sat, 21 Aug 2004 04:20:50 +0000 Subject: Mirror change in archivers/mtree by on 2004/04/16: Introduce HAVE_FILE_FLAGS if the system declares UF_SETTABLE and SF_SETTABLE in addition to member 'st_flags' of struct stat. Use HAVE_FILE_FLAGS instead of HAVE_STRUCT_STAT_ST_FLAGS. This avoids confusion on UnixWare which has 'st_flags' but does _not_ support file flags. --- archivers/pax/files/config.h.in | 14 ++++ archivers/pax/files/configure | 144 +++++++++++++++++++++++++++++++++++++++ archivers/pax/files/configure.ac | 6 ++ archivers/pax/files/file_subs.c | 8 +-- archivers/pax/files/ftree.c | 6 +- archivers/pax/files/stat_flags.c | 8 +-- archivers/pax/files/tables.c | 8 +-- 7 files changed, 179 insertions(+), 15 deletions(-) (limited to 'archivers/pax') diff --git a/archivers/pax/files/config.h.in b/archivers/pax/files/config.h.in index a03d8efd307..2ef31ef8d02 100644 --- a/archivers/pax/files/config.h.in +++ b/archivers/pax/files/config.h.in @@ -3,6 +3,14 @@ /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H +/* Define to 1 if you have the declaration of `SF_SETTABLE', and to 0 if you + don't. */ +#undef HAVE_DECL_SF_SETTABLE + +/* Define to 1 if you have the declaration of `UF_SETTABLE', and to 0 if you + don't. */ +#undef HAVE_DECL_UF_SETTABLE + /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H @@ -149,3 +157,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS + +/* Define to 1 if the user- and root-changeable masks were detected */ +#if HAVE_STRUCT_STAT_ST_FLAGS && HAVE_DECL_UF_SETTABLE && HAVE_DECL_SF_SETTABLE +#define HAVE_FILE_FLAGS 1 +#endif + diff --git a/archivers/pax/files/configure b/archivers/pax/files/configure index 4b1da1b2eff..29ee50fd6b4 100755 --- a/archivers/pax/files/configure +++ b/archivers/pax/files/configure @@ -3368,6 +3368,150 @@ _ACEOF fi +echo "$as_me:$LINENO: checking whether UF_SETTABLE is declared" >&5 +echo $ECHO_N "checking whether UF_SETTABLE is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_UF_SETTABLE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef UF_SETTABLE + char *p = (char *) UF_SETTABLE; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_UF_SETTABLE=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_UF_SETTABLE=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_UF_SETTABLE" >&5 +echo "${ECHO_T}$ac_cv_have_decl_UF_SETTABLE" >&6 +if test $ac_cv_have_decl_UF_SETTABLE = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_UF_SETTABLE 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_UF_SETTABLE 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether SF_SETTABLE is declared" >&5 +echo $ECHO_N "checking whether SF_SETTABLE is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_SF_SETTABLE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef SF_SETTABLE + char *p = (char *) SF_SETTABLE; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_SF_SETTABLE=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_SF_SETTABLE=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_SF_SETTABLE" >&5 +echo "${ECHO_T}$ac_cv_have_decl_SF_SETTABLE" >&6 +if test $ac_cv_have_decl_SF_SETTABLE = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SF_SETTABLE 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SF_SETTABLE 0 +_ACEOF + + +fi + + + + # Checks for library functions. diff --git a/archivers/pax/files/configure.ac b/archivers/pax/files/configure.ac index 0a8b70bbd06..ca233967660 100644 --- a/archivers/pax/files/configure.ac +++ b/archivers/pax/files/configure.ac @@ -22,6 +22,12 @@ AC_CHECK_HEADERS([sys/cdefs.h sys/ioctl.h sys/mtio.h sys/param.h \ sys/resource.h sys/stat.h sys/tape.h sys/time.h sys/types.h sys/uio.h \ sys/wait.h]) AC_CHECK_MEMBERS([struct stat.st_flags],,, [#include ]) +AC_CHECK_DECLS([UF_SETTABLE, SF_SETTABLE]) +AH_BOTTOM([/* Define to 1 if the user- and root-changeable masks were detected */ +#if HAVE_STRUCT_STAT_ST_FLAGS && HAVE_DECL_UF_SETTABLE && HAVE_DECL_SF_SETTABLE +#define HAVE_FILE_FLAGS 1 +#endif +]) # Checks for library functions. AC_CHECK_FUNCS([lutimes]) diff --git a/archivers/pax/files/file_subs.c b/archivers/pax/files/file_subs.c index b3648b85b3c..545b182b880 100644 --- a/archivers/pax/files/file_subs.c +++ b/archivers/pax/files/file_subs.c @@ -1,4 +1,4 @@ -/* $NetBSD: file_subs.c,v 1.9 2004/08/21 03:28:56 jlam Exp $ */ +/* $NetBSD: file_subs.c,v 1.10 2004/08/21 04:20:50 jlam Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)file_subs.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: file_subs.c,v 1.9 2004/08/21 03:28:56 jlam Exp $"); +__RCSID("$NetBSD: file_subs.c,v 1.10 2004/08/21 04:20:50 jlam Exp $"); #endif #endif /* not lint */ @@ -230,7 +230,7 @@ file_close(ARCHD *arcn, int fd) (void)unlink(arcn->tmp_name); } -#if HAVE_STRUCT_STAT_ST_FLAGS +#if HAVE_FILE_FLAGS if (pfflags && arcn->type != PAX_SLK) set_chflags(arcn->name, arcn->sb.st_flags); #endif @@ -600,7 +600,7 @@ badlink: #endif set_ftime(arcn->name, arcn->sb.st_mtime, arcn->sb.st_atime, 0); -#if HAVE_STRUCT_STAT_ST_FLAGS +#if HAVE_FILE_FLAGS if (pfflags && arcn->type != PAX_SLK) set_chflags(arcn->name, arcn->sb.st_flags); #endif diff --git a/archivers/pax/files/ftree.c b/archivers/pax/files/ftree.c index 2a35a95b878..4a0177144f6 100644 --- a/archivers/pax/files/ftree.c +++ b/archivers/pax/files/ftree.c @@ -1,4 +1,4 @@ -/* $NetBSD: ftree.c,v 1.7 2004/08/21 03:28:56 jlam Exp $ */ +/* $NetBSD: ftree.c,v 1.8 2004/08/21 04:20:50 jlam Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -84,7 +84,7 @@ #if 0 static char sccsid[] = "@(#)ftree.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: ftree.c,v 1.7 2004/08/21 03:28:56 jlam Exp $"); +__RCSID("$NetBSD: ftree.c,v 1.8 2004/08/21 04:20:50 jlam Exp $"); #endif #endif /* not lint */ @@ -544,7 +544,7 @@ next_file(ARCHD *arcn) statbuf.st_gid = ftnode->st_gid; if (ftnode->flags & (F_UID | F_UNAME)) statbuf.st_uid = ftnode->st_uid; -#if HAVE_STRUCT_STAT_ST_FLAGS +#if HAVE_FILE_FLAGS if (ftnode->flags & F_FLAGS) statbuf.st_flags = ftnode->st_flags; #endif diff --git a/archivers/pax/files/stat_flags.c b/archivers/pax/files/stat_flags.c index 3a9d4db510d..200aca66f9c 100644 --- a/archivers/pax/files/stat_flags.c +++ b/archivers/pax/files/stat_flags.c @@ -1,4 +1,4 @@ -/* $NetBSD: stat_flags.c,v 1.2 2004/08/21 03:28:56 jlam Exp $ */ +/* $NetBSD: stat_flags.c,v 1.3 2004/08/21 04:20:50 jlam Exp $ */ /*- * Copyright (c) 1993 @@ -44,7 +44,7 @@ #if 0 static char sccsid[] = "@(#)stat_flags.c 8.2 (Berkeley) 7/28/94"; #else -__RCSID("$NetBSD: stat_flags.c,v 1.2 2004/08/21 03:28:56 jlam Exp $"); +__RCSID("$NetBSD: stat_flags.c,v 1.3 2004/08/21 04:20:50 jlam Exp $"); #endif #endif /* not lint */ @@ -86,7 +86,7 @@ flags_to_string(u_long flags, const char *def) string[0] = '\0'; prefix = NULL; -#if HAVE_STRUCT_STAT_ST_FLAGS +#if HAVE_FILE_FLAGS if (flags & UF_APPEND) SAPPEND("uappnd"); if (flags & UF_IMMUTABLE) @@ -145,7 +145,7 @@ string_to_flags(char **stringp, u_long *setp, u_long *clrp) if (clrp) *clrp = 0; -#if HAVE_STRUCT_STAT_ST_FLAGS +#if HAVE_FILE_FLAGS string = *stringp; while ((p = strsep(&string, "\t ,")) != NULL) { clear = 0; diff --git a/archivers/pax/files/tables.c b/archivers/pax/files/tables.c index 4bbef99bdb5..0545671e184 100644 --- a/archivers/pax/files/tables.c +++ b/archivers/pax/files/tables.c @@ -1,4 +1,4 @@ -/* $NetBSD: tables.c,v 1.4 2004/08/21 03:28:56 jlam Exp $ */ +/* $NetBSD: tables.c,v 1.5 2004/08/21 04:20:50 jlam Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -48,7 +48,7 @@ #if 0 static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: tables.c,v 1.4 2004/08/21 03:28:56 jlam Exp $"); +__RCSID("$NetBSD: tables.c,v 1.5 2004/08/21 04:20:50 jlam Exp $"); #endif #endif /* not lint */ @@ -1195,7 +1195,7 @@ add_dir(char *name, int nlen, struct stat *psb, int frc_mode) dblk.mode = psb->st_mode & 0xffff; dblk.mtime = psb->st_mtime; dblk.atime = psb->st_atime; -#if HAVE_STRUCT_STAT_ST_FLAGS +#if HAVE_FILE_FLAGS dblk.fflags = psb->st_flags; #else dblk.fflags = 0; @@ -1225,7 +1225,7 @@ add_dir(char *name, int nlen, struct stat *psb, int frc_mode) dblk->mode = psb->st_mode & 0xffff; dblk->mtime = psb->st_mtime; dblk->atime = psb->st_atime; -#if HAVE_STRUCT_STAT_ST_FLAGS +#if HAVE_FILE_FLAGS dblk->fflags = psb->st_flags; #else dblk->fflags = 0; -- cgit v1.2.3