diff --git a/config.h.in b/config.h.in index 616429f..51fa1fc 100644 --- a/config.h.in +++ b/config.h.in @@ -102,6 +102,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the `swab' function. */ +#undef HAVE_SWAB + /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H @@ -135,6 +138,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_UNISTD_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_USTAT_H diff --git a/configure b/configure index f08717a..c33967d 100755 --- a/configure +++ b/configure @@ -5569,7 +5569,20 @@ fi done -for ac_header in unistd.h syslog.h langinfo.h sys/statfs.h sys/select.h +for ac_header in unistd.h sys/unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in syslog.h langinfo.h sys/statfs.h sys/select.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -6182,6 +6195,17 @@ _ACEOF fi done +for ac_func in swab +do : + ac_fn_c_check_func "$LINENO" "swab" "ac_cv_func_swab" +if test "x$ac_cv_func_swab" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SWAB 1 +_ACEOF + +fi +done + for ac_header in fcntl.h do : diff --git a/configure.ac b/configure.ac index 3cc105e..5d7a0b1 100644 --- a/configure.ac +++ b/configure.ac @@ -99,7 +99,8 @@ AC_CHECK_HEADERS(sys/mount.h,,, #endif ]]) AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h) -AC_CHECK_HEADERS(unistd.h syslog.h langinfo.h sys/statfs.h sys/select.h) +AC_CHECK_HEADERS(unistd.h sys/unistd.h) +AC_CHECK_HEADERS(syslog.h langinfo.h sys/statfs.h sys/select.h) AC_CHECK_HEADERS(signum.h bits/signum.h, break ) AC_CHECK_HEADERS(stdarg.h varargs.h, break ) AC_CHECK_HEADERS(sys/utsname.h memory.h) @@ -143,6 +144,7 @@ dnl Checks for standard functions dnl ############################# AC_CHECK_FUNCS(strftime gethostname gethostid) AC_CHECK_FUNCS(mkstemp mktemp, break) +AC_CHECK_FUNCS(swab) dnl check for posix_fadvise AC_CHECK_HEADERS(fcntl.h, [AC_CHECK_FUNCS(posix_fadvise)]) diff --git a/src/core/platform.h b/src/core/platform.h index 56155be..cfb424f 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -303,7 +303,7 @@ #define SUPPORTS_POSIX_SIGNALS (!IS_DOS_DJGPP) #define SUPPORTS_NETWORKING (!IS_SORTIX && !IS_DOS_DJGPP) #define SUPPORTS_SYSLOG (HAVE_SYSLOG_H && !IS_SKYOS && !IS_RISCOS) -#define NEEDS_SWAB_IMPL (IS_SYLLABLE || IS_ANDROID || IS_SORTIX) +#define NEEDS_SWAB_IMPL (IS_CYGWIN || IS_SYLLABLE || IS_ANDROID || IS_SORTIX) #define USES_MBLEN (!IS_ANDROID && !IS_AROS) #define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP) #define ICONV_CONST_SOURCE (IS_MINIX) diff --git a/src/test-harness/tests/polupdate.pm b/src/test-harness/tests/polupdate.pm index bc4a4d1..a554a1b 100644 --- a/src/test-harness/tests/polupdate.pm +++ b/src/test-harness/tests/polupdate.pm @@ -56,31 +56,31 @@ POLICY_END ###################################################################### # CreateFile -- create a file with the specified contents # -# input: path -- path to the file; relative to $root +# input: path -- *absolute* path to the file # contents -- string to put in the file # sub CreateFile { my ($path, $contents) = @_; - system( "echo $contents > $root/$path" ); + system( "echo $contents > $path" ); - $? && die "Create file failed for $root/$path\n"; + $? && die "Create file failed for $path\n"; } ###################################################################### -# RemoveFile -- removes the named file +# RemoveFile -- removes the named file by absolute path # sub RemoveFile { my ($path) = @_; - if( -e "$root/$path" ) + if( -e $path ) { - system( "rm -f $root/$path" ); + system( "rm -f $path" ); } - $? && die "Remove file failed for $root/$path\n"; + $? && die "Remove file failed for $path\n"; } diff --git a/src/twadmin/twadmincl.cpp b/src/twadmin/twadmincl.cpp index 0c79a26..068d05f 100644 --- a/src/twadmin/twadmincl.cpp +++ b/src/twadmin/twadmincl.cpp @@ -34,8 +34,6 @@ // #include "stdtwadmin.h" -#include - #include "twadmincl.h" #include "twadminstrings.h" #include "keygeneration.h" @@ -63,8 +61,10 @@ #include "twcrypto/crypto.h" #include "core/displayencoder.h" +#include + //Provide a swab() impl. from glibc, for platforms that don't have one -#if NEEDS_SWAB_IMPL +#if !HAVE_SWAB || NEEDS_SWAB_IMPL void swab (const void *bfrom, void *bto, ssize_t n) { const char *from = (const char *) bfrom;