Build & link successfully with a cross compiler targeting VxWorks, though I can't actually test it yet; clean up & extend platform & file type detection a bit
This commit is contained in:
parent
e52b84518c
commit
edec2a4bdd
77
config.h.in
77
config.h.in
|
@ -15,6 +15,18 @@
|
||||||
/* Define to 1 if you have the <bits/signum.h> header file. */
|
/* Define to 1 if you have the <bits/signum.h> header file. */
|
||||||
#undef HAVE_BITS_SIGNUM_H
|
#undef HAVE_BITS_SIGNUM_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `break' function. */
|
||||||
|
#undef HAVE_BREAK
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `broken_ac_check_func' function. */
|
||||||
|
#undef HAVE_BROKEN_AC_CHECK_FUNC
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `chmod' function. */
|
||||||
|
#undef HAVE_CHMOD
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `chown' function. */
|
||||||
|
#undef HAVE_CHOWN
|
||||||
|
|
||||||
/* Uses the Clang compiler */
|
/* Uses the Clang compiler */
|
||||||
#undef HAVE_CLANG
|
#undef HAVE_CLANG
|
||||||
|
|
||||||
|
@ -24,6 +36,9 @@
|
||||||
/* Define to 1 if you have the `closedir' function. */
|
/* Define to 1 if you have the `closedir' function. */
|
||||||
#undef HAVE_CLOSEDIR
|
#undef HAVE_CLOSEDIR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `closelog' function. */
|
||||||
|
#undef HAVE_CLOSELOG
|
||||||
|
|
||||||
/* Define to 1 if you have the <CommonCrypto/CommonDigest.h> header file. */
|
/* Define to 1 if you have the <CommonCrypto/CommonDigest.h> header file. */
|
||||||
#undef HAVE_COMMONCRYPTO_COMMONDIGEST_H
|
#undef HAVE_COMMONCRYPTO_COMMONDIGEST_H
|
||||||
|
|
||||||
|
@ -33,6 +48,9 @@
|
||||||
/* Define to 1 if you have the <door.h> header file. */
|
/* Define to 1 if you have the <door.h> header file. */
|
||||||
#undef HAVE_DOOR_H
|
#undef HAVE_DOOR_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `exec' function. */
|
||||||
|
#undef HAVE_EXEC
|
||||||
|
|
||||||
/* Define to 1 if you have the `fclose' function. */
|
/* Define to 1 if you have the `fclose' function. */
|
||||||
#undef HAVE_FCLOSE
|
#undef HAVE_FCLOSE
|
||||||
|
|
||||||
|
@ -42,6 +60,9 @@
|
||||||
/* Define to 1 if you have the `fopen' function. */
|
/* Define to 1 if you have the `fopen' function. */
|
||||||
#undef HAVE_FOPEN
|
#undef HAVE_FOPEN
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `fork' function. */
|
||||||
|
#undef HAVE_FORK
|
||||||
|
|
||||||
/* Define to 1 if you have the `fread' function. */
|
/* Define to 1 if you have the `fread' function. */
|
||||||
#undef HAVE_FREAD
|
#undef HAVE_FREAD
|
||||||
|
|
||||||
|
@ -54,12 +75,21 @@
|
||||||
/* Uses the GNU gcc compiler */
|
/* Uses the GNU gcc compiler */
|
||||||
#undef HAVE_GCC
|
#undef HAVE_GCC
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `gethostbyname' function. */
|
||||||
|
#undef HAVE_GETHOSTBYNAME
|
||||||
|
|
||||||
/* Define to 1 if you have the `gethostid' function. */
|
/* Define to 1 if you have the `gethostid' function. */
|
||||||
#undef HAVE_GETHOSTID
|
#undef HAVE_GETHOSTID
|
||||||
|
|
||||||
/* Define to 1 if you have the `gethostname' function. */
|
/* Define to 1 if you have the `gethostname' function. */
|
||||||
#undef HAVE_GETHOSTNAME
|
#undef HAVE_GETHOSTNAME
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getuid' function. */
|
||||||
|
#undef HAVE_GETUID
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <grp.h> header file. */
|
||||||
|
#undef HAVE_GRP_H
|
||||||
|
|
||||||
/* Uses the aCC compiler */
|
/* Uses the aCC compiler */
|
||||||
#undef HAVE_HP_ACC
|
#undef HAVE_HP_ACC
|
||||||
|
|
||||||
|
@ -81,6 +111,9 @@
|
||||||
/* Define to 1 if you have the <limits> header file. */
|
/* Define to 1 if you have the <limits> header file. */
|
||||||
#undef HAVE_LIMITS
|
#undef HAVE_LIMITS
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `link' function. */
|
||||||
|
#undef HAVE_LINK
|
||||||
|
|
||||||
/* Define to 1 if you have the <locale> header file. */
|
/* Define to 1 if you have the <locale> header file. */
|
||||||
#undef HAVE_LOCALE
|
#undef HAVE_LOCALE
|
||||||
|
|
||||||
|
@ -108,6 +141,9 @@
|
||||||
/* Define to 1 if you have the `opendir' function. */
|
/* Define to 1 if you have the `opendir' function. */
|
||||||
#undef HAVE_OPENDIR
|
#undef HAVE_OPENDIR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `openlog' function. */
|
||||||
|
#undef HAVE_OPENLOG
|
||||||
|
|
||||||
/* Define to 1 if you have the <openssl/md5.h> header file. */
|
/* Define to 1 if you have the <openssl/md5.h> header file. */
|
||||||
#undef HAVE_OPENSSL_MD5_H
|
#undef HAVE_OPENSSL_MD5_H
|
||||||
|
|
||||||
|
@ -117,6 +153,9 @@
|
||||||
/* Uses the sunCC compiler */
|
/* Uses the sunCC compiler */
|
||||||
#undef HAVE_ORACLE_SUNCC
|
#undef HAVE_ORACLE_SUNCC
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `popen' function. */
|
||||||
|
#undef HAVE_POPEN
|
||||||
|
|
||||||
/* Define to 1 if you have the `port_create' function. */
|
/* Define to 1 if you have the `port_create' function. */
|
||||||
#undef HAVE_PORT_CREATE
|
#undef HAVE_PORT_CREATE
|
||||||
|
|
||||||
|
@ -126,6 +165,9 @@
|
||||||
/* Define to 1 if you have the `posix_fadvise' function. */
|
/* Define to 1 if you have the `posix_fadvise' function. */
|
||||||
#undef HAVE_POSIX_FADVISE
|
#undef HAVE_POSIX_FADVISE
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <pwd.h> header file. */
|
||||||
|
#undef HAVE_PWD_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `read' function. */
|
/* Define to 1 if you have the `read' function. */
|
||||||
#undef HAVE_READ
|
#undef HAVE_READ
|
||||||
|
|
||||||
|
@ -141,6 +183,9 @@
|
||||||
/* Define to 1 if you have the <signum.h> header file. */
|
/* Define to 1 if you have the <signum.h> header file. */
|
||||||
#undef HAVE_SIGNUM_H
|
#undef HAVE_SIGNUM_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `socket' function. */
|
||||||
|
#undef HAVE_SOCKET
|
||||||
|
|
||||||
/* Define to 1 if you have the `stat' function. */
|
/* Define to 1 if you have the `stat' function. */
|
||||||
#undef HAVE_STAT
|
#undef HAVE_STAT
|
||||||
|
|
||||||
|
@ -168,9 +213,15 @@
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
/* Define to 1 if you have the <string.h> header file. */
|
||||||
#undef HAVE_STRING_H
|
#undef HAVE_STRING_H
|
||||||
|
|
||||||
|
/* Define to 1 if `st_attrib' is a member of `struct stat'. */
|
||||||
|
#undef HAVE_STRUCT_STAT_ST_ATTRIB
|
||||||
|
|
||||||
/* Define to 1 if `st_blocks' is a member of `struct stat'. */
|
/* Define to 1 if `st_blocks' is a member of `struct stat'. */
|
||||||
#undef HAVE_STRUCT_STAT_ST_BLOCKS
|
#undef HAVE_STRUCT_STAT_ST_BLOCKS
|
||||||
|
|
||||||
|
/* Define to 1 if `st_flag' is a member of `struct stat'. */
|
||||||
|
#undef HAVE_STRUCT_STAT_ST_FLAG
|
||||||
|
|
||||||
/* Define to 1 if `st_flags' is a member of `struct stat'. */
|
/* Define to 1 if `st_flags' is a member of `struct stat'. */
|
||||||
#undef HAVE_STRUCT_STAT_ST_FLAGS
|
#undef HAVE_STRUCT_STAT_ST_FLAGS
|
||||||
|
|
||||||
|
@ -183,9 +234,18 @@
|
||||||
/* Define to 1 if you have the `swab' function. */
|
/* Define to 1 if you have the `swab' function. */
|
||||||
#undef HAVE_SWAB
|
#undef HAVE_SWAB
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `symlink' function. */
|
||||||
|
#undef HAVE_SYMLINK
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `syslog' function. */
|
||||||
|
#undef HAVE_SYSLOG
|
||||||
|
|
||||||
/* Define to 1 if you have the <syslog.h> header file. */
|
/* Define to 1 if you have the <syslog.h> header file. */
|
||||||
#undef HAVE_SYSLOG_H
|
#undef HAVE_SYSLOG_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/file.h> header file. */
|
||||||
|
#undef HAVE_SYS_FILE_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/fs/vx_ioctl.h> header file. */
|
/* Define to 1 if you have the <sys/fs/vx_ioctl.h> header file. */
|
||||||
#undef HAVE_SYS_FS_VX_IOCTL_H
|
#undef HAVE_SYS_FS_VX_IOCTL_H
|
||||||
|
|
||||||
|
@ -213,6 +273,9 @@
|
||||||
/* Define to 1 if you have the <sys/sysmacros.h> header file. */
|
/* Define to 1 if you have the <sys/sysmacros.h> header file. */
|
||||||
#undef HAVE_SYS_SYSMACROS_H
|
#undef HAVE_SYS_SYSMACROS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||||
|
#undef HAVE_SYS_TIME_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||||
#undef HAVE_SYS_TYPES_H
|
#undef HAVE_SYS_TYPES_H
|
||||||
|
|
||||||
|
@ -225,6 +288,15 @@
|
||||||
/* Define to 1 if you have the <sys/utsname.h> header file. */
|
/* Define to 1 if you have the <sys/utsname.h> header file. */
|
||||||
#undef HAVE_SYS_UTSNAME_H
|
#undef HAVE_SYS_UTSNAME_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <termios.h> header file. */
|
||||||
|
#undef HAVE_TERMIOS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `tmpnam' function. */
|
||||||
|
#undef HAVE_TMPNAM
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `tzset' function. */
|
||||||
|
#undef HAVE_TZSET
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#undef HAVE_UNISTD_H
|
#undef HAVE_UNISTD_H
|
||||||
|
|
||||||
|
@ -243,6 +315,9 @@
|
||||||
/* Define to 1 if you have the file `/dev/urandom'. */
|
/* Define to 1 if you have the file `/dev/urandom'. */
|
||||||
#undef HAVE__DEV_URANDOM
|
#undef HAVE__DEV_URANDOM
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `_exit' function. */
|
||||||
|
#undef HAVE__EXIT
|
||||||
|
|
||||||
/* Is byte aligned */
|
/* Is byte aligned */
|
||||||
#undef IS_BYTE_ALIGNED
|
#undef IS_BYTE_ALIGNED
|
||||||
|
|
||||||
|
@ -340,3 +415,5 @@
|
||||||
|
|
||||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
#undef size_t
|
#undef size_t
|
||||||
|
|
||||||
|
#include "core/fixups.h"
|
||||||
|
|
|
@ -3284,6 +3284,8 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||||
|
|
||||||
CXXFLAGS=${tmp_cxxflags}
|
CXXFLAGS=${tmp_cxxflags}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ac_ext=c
|
ac_ext=c
|
||||||
ac_cpp='$CPP $CPPFLAGS'
|
ac_cpp='$CPP $CPPFLAGS'
|
||||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
@ -5543,7 +5545,7 @@ fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_header in unistd.h sys/unistd.h
|
for ac_header in unistd.h sys/unistd.h pwd.h grp.h termios.h
|
||||||
do :
|
do :
|
||||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||||
|
@ -5556,7 +5558,7 @@ fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_header in syslog.h langinfo.h sys/statfs.h sys/select.h
|
for ac_header in syslog.h langinfo.h sys/statfs.h sys/select.h sys/time.h sys/file.h
|
||||||
do :
|
do :
|
||||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||||
|
@ -6178,6 +6180,24 @@ cat >>confdefs.h <<_ACEOF
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
ac_fn_cxx_check_member "$LINENO" "struct stat" "st_flag" "ac_cv_member_struct_stat_st_flag" "$ac_includes_default"
|
||||||
|
if test "x$ac_cv_member_struct_stat_st_flag" = xyes; then :
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_STRUCT_STAT_ST_FLAG 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
ac_fn_cxx_check_member "$LINENO" "struct stat" "st_attrib" "ac_cv_member_struct_stat_st_attrib" "$ac_includes_default"
|
||||||
|
if test "x$ac_cv_member_struct_stat_st_attrib" = xyes; then :
|
||||||
|
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_STRUCT_STAT_ST_ATTRIB 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -6382,7 +6402,30 @@ rm -rf conftest*
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
for ac_func in strftime gethostname gethostid
|
for ac_func in broken_ac_check_func
|
||||||
|
do :
|
||||||
|
ac_fn_cxx_check_func "$LINENO" "broken_ac_check_func" "ac_cv_func_broken_ac_check_func"
|
||||||
|
if test "x$ac_cv_func_broken_ac_check_func" = xyes; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_BROKEN_AC_CHECK_FUNC 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
for ac_func in strftime
|
||||||
|
do :
|
||||||
|
ac_fn_cxx_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
|
||||||
|
if test "x$ac_cv_func_strftime" = xyes; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_STRFTIME 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for ac_func in gethostname gethostbyname gethostid getuid
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
@ -6394,7 +6437,7 @@ _ACEOF
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_func in mkstemp mktemp
|
for ac_func in mkstemp mktemp tmpnam break
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
@ -6402,16 +6445,17 @@ if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||||
_ACEOF
|
_ACEOF
|
||||||
break
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for ac_func in swab
|
for ac_func in swab tzset _exit popen
|
||||||
do :
|
do :
|
||||||
ac_fn_cxx_check_func "$LINENO" "swab" "ac_cv_func_swab"
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
if test "x$ac_cv_func_swab" = xyes; then :
|
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
#define HAVE_SWAB 1
|
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -6479,6 +6523,43 @@ fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
for ac_func in chown chmod link symlink
|
||||||
|
do :
|
||||||
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
|
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for ac_func in openlog syslog closelog
|
||||||
|
do :
|
||||||
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
|
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for ac_func in fork exec socket
|
||||||
|
do :
|
||||||
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
|
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
for ac_header in fcntl.h
|
for ac_header in fcntl.h
|
||||||
do :
|
do :
|
||||||
ac_fn_cxx_check_header_mongrel "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default"
|
ac_fn_cxx_check_header_mongrel "$LINENO" "fcntl.h" "ac_cv_header_fcntl_h" "$ac_includes_default"
|
||||||
|
@ -6648,7 +6729,8 @@ case $host_os in
|
||||||
aros*)
|
aros*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/random" >&5
|
if test "$cross_compiling" != yes; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/random" >&5
|
||||||
$as_echo_n "checking for /dev/random... " >&6; }
|
$as_echo_n "checking for /dev/random... " >&6; }
|
||||||
if ${ac_cv_file__dev_random+:} false; then :
|
if ${ac_cv_file__dev_random+:} false; then :
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
|
@ -6715,6 +6797,7 @@ _ACEOF
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -7386,6 +7469,7 @@ if test "${enable_openssl+set}" = set; then :
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether --with-ssl-dir was given.
|
# Check whether --with-ssl-dir was given.
|
||||||
if test "${with_ssl_dir+set}" = set; then :
|
if test "${with_ssl_dir+set}" = set; then :
|
||||||
withval=$with_ssl_dir;
|
withval=$with_ssl_dir;
|
||||||
|
@ -7446,7 +7530,7 @@ else
|
||||||
|
|
||||||
# Basic test to check for compatible library and
|
# Basic test to check for compatible library and
|
||||||
# correct linking
|
# correct linking
|
||||||
if test "$cross_compiling" = yes; then
|
if test "x$cross_compiling" = "xyes"; then
|
||||||
found_crypto=1
|
found_crypto=1
|
||||||
else
|
else
|
||||||
if test "$cross_compiling" = yes; then :
|
if test "$cross_compiling" = yes; then :
|
||||||
|
|
44
configure.ac
44
configure.ac
|
@ -18,6 +18,13 @@ tmp_cxxflags=${CXXFLAGS}
|
||||||
AC_LANG_CPLUSPLUS
|
AC_LANG_CPLUSPLUS
|
||||||
CXXFLAGS=${tmp_cxxflags}
|
CXXFLAGS=${tmp_cxxflags}
|
||||||
|
|
||||||
|
dnl *******************************************************
|
||||||
|
dnl Append an include to config.h for a handcrafted header
|
||||||
|
dnl that sets things back to (hopefully) correct values
|
||||||
|
dnl for known cases where autoconf does the Wrong Thing
|
||||||
|
dnl *******************************************************
|
||||||
|
AH_BOTTOM([#include "core/fixups.h"])
|
||||||
|
|
||||||
dnl ###################
|
dnl ###################
|
||||||
dnl Checks for programs
|
dnl Checks for programs
|
||||||
dnl ###################
|
dnl ###################
|
||||||
|
@ -178,8 +185,8 @@ AC_CHECK_HEADERS(sys/mount.h,,,
|
||||||
#endif
|
#endif
|
||||||
]])
|
]])
|
||||||
AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h)
|
AC_CHECK_HEADERS(sys/ustat.h sys/sysmacros.h sys/syslog.h sys/socket.h)
|
||||||
AC_CHECK_HEADERS(unistd.h sys/unistd.h)
|
AC_CHECK_HEADERS(unistd.h sys/unistd.h pwd.h grp.h termios.h)
|
||||||
AC_CHECK_HEADERS(syslog.h langinfo.h sys/statfs.h sys/select.h)
|
AC_CHECK_HEADERS(syslog.h langinfo.h sys/statfs.h sys/select.h sys/time.h sys/file.h)
|
||||||
AC_CHECK_HEADERS(signum.h bits/signum.h, break )
|
AC_CHECK_HEADERS(signum.h bits/signum.h, break )
|
||||||
AC_CHECK_HEADERS(stdarg.h varargs.h, break )
|
AC_CHECK_HEADERS(stdarg.h varargs.h, break )
|
||||||
AC_CHECK_HEADERS(sys/utsname.h memory.h)
|
AC_CHECK_HEADERS(sys/utsname.h memory.h)
|
||||||
|
@ -219,18 +226,27 @@ AC_DEFINE(IS_UNIX, 1, [Is a unix type platform])
|
||||||
dnl whether or not to generate debuging code?
|
dnl whether or not to generate debuging code?
|
||||||
dnl this gets defined elsewhere based on config args AC_DEFINE(NDEBUG, 1, [don't generate debuging code])
|
dnl this gets defined elsewhere based on config args AC_DEFINE(NDEBUG, 1, [don't generate debuging code])
|
||||||
|
|
||||||
dnl look for struct stat members that aren't always there
|
dnl look for struct stat members that aren't always there:
|
||||||
AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blocks, struct stat.st_flags, struct stat.st_gen])
|
dnl st_rdev & st_blocks are standard but a few platforms don't have them.
|
||||||
|
dnl st_flags & st_gen are BSD-isms & are mostly seen there, including macOS
|
||||||
|
dnl st_flag (singular) is AIX-only, while st_attrib holds DOS attribute bits on VxWorks
|
||||||
|
AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blocks, struct stat.st_flags, struct stat.st_gen, struct stat.st_flag, struct stat.st_attrib])
|
||||||
|
|
||||||
dnl detect large file support & use it where available
|
dnl detect large file support & use it where available
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
|
dnl ******************************************
|
||||||
|
dnl Check whether AC_CHECK_FUNC(S) lies to us
|
||||||
|
dnl ******************************************
|
||||||
|
AC_CHECK_FUNCS(broken_ac_check_func)
|
||||||
|
|
||||||
dnl #############################
|
dnl #############################
|
||||||
dnl Checks for standard functions
|
dnl Checks for standard functions
|
||||||
dnl #############################
|
dnl #############################
|
||||||
AC_CHECK_FUNCS(strftime gethostname gethostid)
|
AC_CHECK_FUNCS(strftime)
|
||||||
AC_CHECK_FUNCS(mkstemp mktemp, break)
|
AC_CHECK_FUNCS(gethostname gethostbyname gethostid getuid)
|
||||||
AC_CHECK_FUNCS(swab)
|
AC_CHECK_FUNCS(mkstemp mktemp tmpnam break)
|
||||||
|
AC_CHECK_FUNCS(swab tzset _exit popen)
|
||||||
|
|
||||||
dnl posix way to read files
|
dnl posix way to read files
|
||||||
AC_CHECK_FUNCS(openat open read close)
|
AC_CHECK_FUNCS(openat open read close)
|
||||||
|
@ -243,6 +259,13 @@ AC_CHECK_FUNCS(statx fstatat lstat stat)
|
||||||
dnl posix way to get symlink contents
|
dnl posix way to get symlink contents
|
||||||
AC_CHECK_FUNCS(readlinkat readlink)
|
AC_CHECK_FUNCS(readlinkat readlink)
|
||||||
|
|
||||||
|
dnl posix fns that make filesystem changes
|
||||||
|
AC_CHECK_FUNCS(chown chmod link symlink)
|
||||||
|
dnl posix syslog fns
|
||||||
|
AC_CHECK_FUNCS(openlog syslog closelog)
|
||||||
|
dnl assorted other posix fns
|
||||||
|
AC_CHECK_FUNCS(fork exec socket)
|
||||||
|
|
||||||
dnl check for posix_fadvise
|
dnl check for posix_fadvise
|
||||||
AC_CHECK_HEADERS(fcntl.h, [AC_CHECK_FUNCS(posix_fadvise)])
|
AC_CHECK_HEADERS(fcntl.h, [AC_CHECK_FUNCS(posix_fadvise)])
|
||||||
|
|
||||||
|
@ -281,7 +304,9 @@ case $host_os in
|
||||||
aros*)
|
aros*)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
AC_CHECK_FILES(/dev/random /dev/urandom /dev/arandom)
|
if test "$cross_compiling" != yes; then
|
||||||
|
AC_CHECK_FILES(/dev/random /dev/urandom /dev/arandom)
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -487,6 +512,7 @@ if you are trying to compile a static binary.
|
||||||
dnl Check for OpenSSL, now that we have a working compiler
|
dnl Check for OpenSSL, now that we have a working compiler
|
||||||
AC_ARG_ENABLE(openssl,
|
AC_ARG_ENABLE(openssl,
|
||||||
[ --disable-openssl Don't link against OpenSSL libraries])
|
[ --disable-openssl Don't link against OpenSSL libraries])
|
||||||
|
|
||||||
AC_ARG_WITH(ssl-dir,
|
AC_ARG_WITH(ssl-dir,
|
||||||
[ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
|
[ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
|
||||||
[
|
[
|
||||||
|
@ -543,7 +569,7 @@ then
|
||||||
|
|
||||||
# Basic test to check for compatible library and
|
# Basic test to check for compatible library and
|
||||||
# correct linking
|
# correct linking
|
||||||
if test "$cross_compiling" = yes; then
|
if test "x$cross_compiling" = "xyes"; then
|
||||||
found_crypto=1
|
found_crypto=1
|
||||||
else
|
else
|
||||||
AC_TRY_RUN(
|
AC_TRY_RUN(
|
||||||
|
|
|
@ -23,7 +23,7 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \
|
||||||
core.h coreerrors.h corestrings.h crc32.h debug.h displayencoder.h \
|
core.h coreerrors.h corestrings.h crc32.h debug.h displayencoder.h \
|
||||||
displayutil.h epoch.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \
|
displayutil.h epoch.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \
|
||||||
errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \
|
errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \
|
||||||
fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \
|
fixups.h fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \
|
||||||
ntmbs.h package.h platform.h refcountobj.h resources.h \
|
ntmbs.h package.h platform.h refcountobj.h resources.h \
|
||||||
serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \
|
serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \
|
||||||
sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \
|
sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \
|
||||||
|
|
|
@ -347,7 +347,7 @@ libcore_a_HEADERS = archive.h charutil.h cmdlineparser.h codeconvert.h \
|
||||||
core.h coreerrors.h corestrings.h crc32.h debug.h displayencoder.h \
|
core.h coreerrors.h corestrings.h crc32.h debug.h displayencoder.h \
|
||||||
displayutil.h epoch.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \
|
displayutil.h epoch.h error.h errorbucket.h errorbucketimpl.h errorgeneral.h \
|
||||||
errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \
|
errortable.h errorutil.h file.h fileerror.h fileheader.h fixedfilebuf.h \
|
||||||
fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \
|
fixups.h fsservices.h growheap.h hashtable.h haval.h md5.h msystem.h ntdbs.h \
|
||||||
ntmbs.h package.h platform.h refcountobj.h resources.h \
|
ntmbs.h package.h platform.h refcountobj.h resources.h \
|
||||||
serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \
|
serializable.h serializer.h serializerimpl.h serializerutil.h serstring.h \
|
||||||
sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \
|
sha.h srefcountobj.h srefcounttbl.h stdcore.h stringutil.h tasktimer.h \
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
#include "archive.h"
|
#include "archive.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BUFSIZE 4096
|
#define BUFFER_SIZE 4096
|
||||||
|
|
||||||
static uint32_t crctab[] = {
|
static uint32_t crctab[] = {
|
||||||
0x0,
|
0x0,
|
||||||
|
|
|
@ -244,8 +244,13 @@ void cFile::Open(const TSTRING& sFileNameC, uint32_t flags)
|
||||||
#if HAVE_POSIX_FADVISE
|
#if HAVE_POSIX_FADVISE
|
||||||
if (flags & OPEN_SCANNING && !(flags & OPEN_DIRECT))
|
if (flags & OPEN_SCANNING && !(flags & OPEN_DIRECT))
|
||||||
{
|
{
|
||||||
|
#ifdef POSIX_FADV_SEQUENTIAL
|
||||||
posix_fadvise(fh, 0, 0, POSIX_FADV_SEQUENTIAL);
|
posix_fadvise(fh, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef POSIX_FADV_NOREUSE
|
||||||
posix_fadvise(fh, 0, 0, POSIX_FADV_NOREUSE);
|
posix_fadvise(fh, 0, 0, POSIX_FADV_NOREUSE);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif HAVE_SYS_FS_VX_IOCTL_H
|
#elif HAVE_SYS_FS_VX_IOCTL_H
|
||||||
|
@ -267,7 +272,7 @@ void cFile::Close() //throw(eFile)
|
||||||
{
|
{
|
||||||
if (mpData->mpCurrStream != NULL)
|
if (mpData->mpCurrStream != NULL)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_POSIX_FADVISE
|
#if defined(HAVE_POSIX_FADVISE) && defined(POSIX_FADV_DONTNEED)
|
||||||
posix_fadvise(fileno(mpData->mpCurrStream), 0, 0, POSIX_FADV_DONTNEED);
|
posix_fadvise(fileno(mpData->mpCurrStream), 0, 0, POSIX_FADV_DONTNEED);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -362,7 +367,11 @@ cFile::File_t cFile::Read(void* buffer, File_t nBytes) const //throw(eFile)
|
||||||
|
|
||||||
if (mpData->mFlags & OPEN_DIRECT)
|
if (mpData->mFlags & OPEN_DIRECT)
|
||||||
{
|
{
|
||||||
|
#if READ_TAKES_CHAR_PTR
|
||||||
|
iBytesRead = read(mpData->m_fd, (char*)buffer, nBytes);
|
||||||
|
#else
|
||||||
iBytesRead = read(mpData->m_fd, buffer, nBytes);
|
iBytesRead = read(mpData->m_fd, buffer, nBytes);
|
||||||
|
#endif
|
||||||
if (iBytesRead < 0)
|
if (iBytesRead < 0)
|
||||||
{
|
{
|
||||||
throw eFileRead(mpData->mFileName, iFSServices::GetInstance()->GetErrString());
|
throw eFileRead(mpData->mFileName, iFSServices::GetInstance()->GetErrString());
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
//
|
||||||
|
// The developer of the original code and/or files is Tripwire, Inc.
|
||||||
|
// Portions created by Tripwire, Inc. are copyright (C) 2000-2019 Tripwire,
|
||||||
|
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
|
||||||
|
// reserved.
|
||||||
|
//
|
||||||
|
// This program is free software. The contents of this file are subject
|
||||||
|
// to the terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
// option) any later version. You may redistribute it and/or modify it
|
||||||
|
// only in compliance with the GNU General Public License.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful.
|
||||||
|
// However, this program is distributed AS-IS WITHOUT ANY
|
||||||
|
// WARRANTY; INCLUDING THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||||
|
// FOR A PARTICULAR PURPOSE. Please see the GNU General Public License
|
||||||
|
// for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||||
|
// USA.
|
||||||
|
//
|
||||||
|
// Nothing in the GNU General Public License or any other license to use
|
||||||
|
// the code or files shall permit you to use Tripwire's trademarks,
|
||||||
|
// service marks, or other intellectual property without Tripwire's
|
||||||
|
// prior written consent.
|
||||||
|
//
|
||||||
|
// If you have any questions, please contact Tripwire, Inc. at either
|
||||||
|
// info@tripwire.org or www.tripwire.org.
|
||||||
|
|
||||||
|
|
||||||
|
// ====================================================================
|
||||||
|
// fixups.h :
|
||||||
|
// This file is included at the end of the generated config.h, for repairing things
|
||||||
|
// the configure script got wrong. Because this does happen now and then.
|
||||||
|
//
|
||||||
|
// This header is intentionally not wrapped with the usual #ifndef/#define/#endif
|
||||||
|
// since config.h itself doesn't do that, and we need to be inclded right after
|
||||||
|
// it each time it's included.
|
||||||
|
|
||||||
|
|
||||||
|
// =====================================================================
|
||||||
|
// Cross compiling to powerpc-wrs-vxworks from linux amd64, observed that
|
||||||
|
// AC_CHECK_FUNC defines HAVE_xxx for every checked function, including
|
||||||
|
// ones that don't and can't exist like fork() & symlink(), and others that
|
||||||
|
// could at least optionally exist, but don't in my cross compiler, like socket().
|
||||||
|
//
|
||||||
|
|
||||||
|
#if HAVE_BROKEN_AC_CHECK_FUNC
|
||||||
|
#if defined(__VXWORKS__) || defined(__vxworks)
|
||||||
|
#undef HAVE__EXIT
|
||||||
|
#undef HAVE_CHOWN
|
||||||
|
#undef HAVE_EXEC
|
||||||
|
#undef HAVE_FORK
|
||||||
|
#undef HAVE_GETHOSTID
|
||||||
|
#undef HAVE_GETUID
|
||||||
|
#undef HAVE_LSTAT
|
||||||
|
#undef HAVE_MKSTEMP
|
||||||
|
#undef HAVE_MKTEMP
|
||||||
|
#undef HAVE_POPEN
|
||||||
|
#undef HAVE_SOCKET
|
||||||
|
#undef HAVE_SYMLINK
|
||||||
|
#undef HAVE_SYSLOG
|
||||||
|
#undef HAVE_READLINK
|
||||||
|
#undef HAVE_TZSET
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
|
@ -136,7 +136,10 @@ struct cFSStatArgs
|
||||||
TY_SOCK,
|
TY_SOCK,
|
||||||
TY_DOOR,
|
TY_DOOR,
|
||||||
TY_PORT,
|
TY_PORT,
|
||||||
TY_NAMED
|
TY_NAMED,
|
||||||
|
TY_MESSAGE_QUEUE,
|
||||||
|
TY_SEMAPHORE,
|
||||||
|
TY_SHARED_MEMORY
|
||||||
};
|
};
|
||||||
|
|
||||||
// attr is fs dependent?
|
// attr is fs dependent?
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#if !IS_SORTIX
|
#if !IS_SORTIX && HAVE_SYS_FILE_H
|
||||||
# include <sys/file.h>
|
# include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -99,8 +99,7 @@
|
||||||
#define setgid(x) sleep(0)
|
#define setgid(x) sleep(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SUPPORTS_POSIX_FORK_EXEC
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* signal type
|
* signal type
|
||||||
*/
|
*/
|
||||||
|
@ -620,6 +619,8 @@ static const char *shellenv()
|
||||||
return(shptr);
|
return(shptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if USES_MSYSTEM
|
||||||
/*
|
/*
|
||||||
* like system but A LOT safer
|
* like system but A LOT safer
|
||||||
*/
|
*/
|
||||||
|
@ -661,6 +662,7 @@ char *cmd;
|
||||||
return(127);
|
return(127);
|
||||||
return(echild(i));
|
return(echild(i));
|
||||||
}
|
}
|
||||||
|
#endif // USES_MSYSTEM
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this structure holds the information associating
|
* this structure holds the information associating
|
||||||
|
@ -672,6 +674,7 @@ static struct popenfunc { /* association of pid, file pointer */
|
||||||
FILE *fp; /* the file pointer */
|
FILE *fp; /* the file pointer */
|
||||||
} pfunc[MAX_MPOPEN];
|
} pfunc[MAX_MPOPEN];
|
||||||
|
|
||||||
|
#if USES_MPOPEN
|
||||||
/*
|
/*
|
||||||
* like popen but A LOT safer
|
* like popen but A LOT safer
|
||||||
*/
|
*/
|
||||||
|
@ -722,6 +725,7 @@ char *mode;
|
||||||
return(NULL);
|
return(NULL);
|
||||||
return(pfunc[indx].fp = ((*mode == 'w') ? fpa[0] : fpa[1]));
|
return(pfunc[indx].fp = ((*mode == 'w') ? fpa[0] : fpa[1]));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* close the pipe
|
* close the pipe
|
||||||
|
@ -1028,7 +1032,6 @@ int echild(pid)
|
||||||
int pid;
|
int pid;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|
||||||
int r; /* PID of process just exited */
|
int r; /* PID of process just exited */
|
||||||
int status; /* status of wait call */
|
int status; /* status of wait call */
|
||||||
|
|
||||||
|
@ -1050,3 +1053,5 @@ int pid;
|
||||||
*/
|
*/
|
||||||
return(status);
|
return(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // SUPPORTS_POSIX_FORK_EXEC
|
||||||
|
|
|
@ -57,6 +57,8 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
#if SUPPORTS_POSIX_FORK_EXEC
|
||||||
|
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
void le_clobber(void);
|
void le_clobber(void);
|
||||||
int le_set(const char*);
|
int le_set(const char*);
|
||||||
|
@ -66,8 +68,15 @@ int le_openfd(int);
|
||||||
int le_closefd(int);
|
int le_closefd(int);
|
||||||
int le_euid(int);
|
int le_euid(int);
|
||||||
int le_egid(int);
|
int le_egid(int);
|
||||||
|
|
||||||
|
#if USES_MSYSTEM
|
||||||
int msystem(const char*);
|
int msystem(const char*);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USES_MPOPEN
|
||||||
FILE *mpopen(const char*, const char*);
|
FILE *mpopen(const char*, const char*);
|
||||||
|
#endif
|
||||||
|
|
||||||
int mpclose(FILE *);
|
int mpclose(FILE *);
|
||||||
int mfpopen(const char*, FILE *[]);
|
int mfpopen(const char*, FILE *[]);
|
||||||
int mfpclose(int, FILE *[]);
|
int mfpclose(int, FILE *[]);
|
||||||
|
@ -136,3 +145,4 @@ int echild();
|
||||||
# define NOSHELL "/bin/sh" /* use this if no shell */
|
# define NOSHELL "/bin/sh" /* use this if no shell */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // SUPPORTS_POSIX_FORK_EXEC
|
||||||
|
|
|
@ -55,43 +55,53 @@
|
||||||
# define OS_CYGWIN 0x0102
|
# define OS_CYGWIN 0x0102
|
||||||
# define OS_DOS_DJGPP 0x0103
|
# define OS_DOS_DJGPP 0x0103
|
||||||
|
|
||||||
# define OS_LINUX 0x0201
|
# define OS_LINUX 0x0201
|
||||||
# define OS_ANDROID 0x0202
|
# define OS_ANDROID 0x0202
|
||||||
|
|
||||||
# define OS_FREEBSD 0x0301
|
# define OS_FREEBSD 0x0301
|
||||||
# define OS_NETBSD 0x0302
|
# define OS_NETBSD 0x0302
|
||||||
# define OS_OPENBSD 0x0303
|
# define OS_OPENBSD 0x0303
|
||||||
# define OS_DARWIN 0x0304
|
# define OS_DARWIN 0x0304
|
||||||
# define OS_DRAGONFLYBSD 0x0305
|
# define OS_DRAGONFLYBSD 0x0305
|
||||||
# define OS_MIDNIGHTBSD 0x0306
|
# define OS_MIDNIGHTBSD 0x0306
|
||||||
# define OS_MIRBSD 0x0307
|
# define OS_MIRBSD 0x0307
|
||||||
# define OS_BITRIG 0x0308
|
# define OS_BITRIG 0x0308
|
||||||
# define OS_LIBERTYBSD 0x0309
|
# define OS_LIBERTYBSD 0x0309
|
||||||
|
# define OS_BSDI 0x030A
|
||||||
|
|
||||||
# define OS_SOLARIS 0x0400
|
# define OS_SOLARIS 0x0400
|
||||||
# define OS_AIX 0x0401
|
# define OS_AIX 0x0401
|
||||||
# define OS_HPUX 0x0402
|
# define OS_HPUX 0x0402
|
||||||
# define OS_IRIX 0x0403
|
# define OS_IRIX 0x0403
|
||||||
# define OS_OSF1 0x0404
|
# define OS_OSF1 0x0404
|
||||||
|
# define OS_OS400 0x0405
|
||||||
|
|
||||||
# define OS_MINIX 0x0501
|
# define OS_MINIX 0x0501
|
||||||
# define OS_HURD 0x0502
|
# define OS_HURD 0x0502
|
||||||
# define OS_HAIKU 0x0503
|
# define OS_HAIKU 0x0503
|
||||||
# define OS_SYLLABLE 0x0504
|
# define OS_SYLLABLE 0x0504
|
||||||
# define OS_SKYOS 0x0505
|
# define OS_SKYOS 0x0505
|
||||||
# define OS_SORTIX 0x0506
|
# define OS_SORTIX 0x0506
|
||||||
# define OS_MINT 0x0507
|
# define OS_MINT 0x0507
|
||||||
# define OS_AROS 0x0508
|
# define OS_AROS 0x0508
|
||||||
# define OS_RTEMS 0x0509
|
# define OS_RTEMS 0x0509
|
||||||
# define OS_RISCOS 0x050A
|
# define OS_RISCOS 0x050A
|
||||||
# define OS_REDOX 0x050B
|
# define OS_REDOX 0x050B
|
||||||
# define OS_QNX 0x050C
|
# define OS_QNX 0x050C
|
||||||
|
# define OS_VXWORKS 0x50D
|
||||||
|
# define OS_LYNXOS 0x50E
|
||||||
|
# define OS_OS9 0x50F // For Microware's OS-9, not the Apple one.
|
||||||
|
# define OS_PLAN9 0x510
|
||||||
|
|
||||||
# define COMP_UNKNOWN 0
|
# define COMP_UNKNOWN 0
|
||||||
# define COMP_GCC 0x0001
|
# define COMP_GCC 0x0001
|
||||||
# define COMP_CLANG 0x0002
|
# define COMP_CLANG 0x0002
|
||||||
|
|
||||||
# define COMP_MSVC 0x0101
|
# define COMP_MSVC 0x0101
|
||||||
|
|
||||||
|
// Definitions for the old KAI C++ compiler.
|
||||||
|
// KCC was EOL'd ages ago, but I'm leaving these definitions here for now
|
||||||
|
// on the off chance someone's still using it.
|
||||||
# define COMP_KAI_GCC 0x0201
|
# define COMP_KAI_GCC 0x0201
|
||||||
# define COMP_KAI_SUNPRO 0x0202
|
# define COMP_KAI_SUNPRO 0x0202
|
||||||
# define COMP_KAI_GLIBC 0x0203
|
# define COMP_KAI_GLIBC 0x0203
|
||||||
|
@ -99,7 +109,10 @@
|
||||||
# define COMP_KAI_HPANSIC 0x0205
|
# define COMP_KAI_HPANSIC 0x0205
|
||||||
# define COMP_KAI_IRIX 0x0206
|
# define COMP_KAI_IRIX 0x0206
|
||||||
# define COMP_KAI_OSF1ALPHA 0x0207
|
# define COMP_KAI_OSF1ALPHA 0x0207
|
||||||
|
|
||||||
# define COMP_SUNPRO 0x0301
|
# define COMP_SUNPRO 0x0301
|
||||||
|
# define COMP_XL_C 0x0302
|
||||||
|
# define COMP_ACC 0x0303
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// Platform detection
|
// Platform detection
|
||||||
|
@ -128,7 +141,7 @@
|
||||||
# define OS OS_DOS_DJGPP
|
# define OS OS_DOS_DJGPP
|
||||||
# define IS_DOS_DJGPP 1
|
# define IS_DOS_DJGPP 1
|
||||||
|
|
||||||
|
// Detect Android first, since Linux macros are also defined there
|
||||||
# elif defined(__ANDROID__)
|
# elif defined(__ANDROID__)
|
||||||
# define OS OS_ANDROID
|
# define OS OS_ANDROID
|
||||||
# define IS_ANDROID 1
|
# define IS_ANDROID 1
|
||||||
|
@ -164,6 +177,9 @@
|
||||||
# define OS OS_BITRIG
|
# define OS OS_BITRIG
|
||||||
# define IS_BITRIG 1
|
# define IS_BITRIG 1
|
||||||
|
|
||||||
|
// Detect LibertyBSD first since OpenBSD macros are also defined.
|
||||||
|
// Autotools can tell them apart by target triplet, so we define
|
||||||
|
// 'TW_LibertybSD' there and pass it in.
|
||||||
# elif defined(TW_LibertyBSD)
|
# elif defined(TW_LibertyBSD)
|
||||||
# define OS OS_LIBERTYBSD
|
# define OS OS_LIBERTYBSD
|
||||||
# define IS_LIBERTYBSD 1
|
# define IS_LIBERTYBSD 1
|
||||||
|
@ -197,6 +213,9 @@
|
||||||
# define OS OS_OSF1
|
# define OS OS_OSF1
|
||||||
# define IS_OSF1 1
|
# define IS_OSF1 1
|
||||||
|
|
||||||
|
# elif defined(__OS400__)
|
||||||
|
# define OS OS_OS400
|
||||||
|
# define IS_OS400 1
|
||||||
|
|
||||||
# elif defined(__minix__)
|
# elif defined(__minix__)
|
||||||
# define OS OS_MINIX
|
# define OS OS_MINIX
|
||||||
|
@ -242,10 +261,26 @@
|
||||||
# define OS OS_REDOX
|
# define OS OS_REDOX
|
||||||
# define IS_REDOX 1
|
# define IS_REDOX 1
|
||||||
|
|
||||||
# elif defined(__QNX__)
|
# elif defined(__QNX__) || defined(__QNXNTO__)
|
||||||
# define OS OS_QNX
|
# define OS OS_QNX
|
||||||
# define IS_QNX 1
|
# define IS_QNX 1
|
||||||
|
|
||||||
|
# elif defined(__VXWORKS__)
|
||||||
|
# define OS OS_VXWORKS
|
||||||
|
# define IS_VXWORKS 1
|
||||||
|
|
||||||
|
# elif defined(__Lynx__)
|
||||||
|
# define OS OS_LYNXOS
|
||||||
|
# define IS_LYNXOS 1
|
||||||
|
|
||||||
|
# elif defined(__OS9000)
|
||||||
|
# define OS OS_OS9
|
||||||
|
# define IS_OS9 1
|
||||||
|
|
||||||
|
# elif defined(EPLAN9)
|
||||||
|
# define OS OS_PLAN9
|
||||||
|
# define IS_PLAN9 1
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -271,6 +306,10 @@
|
||||||
// These macros are the "worker bees" of platform.h. Programmers should use
|
// These macros are the "worker bees" of platform.h. Programmers should use
|
||||||
// these macros rather than comparing PLATFORM to the unique IDs by hand.
|
// these macros rather than comparing PLATFORM to the unique IDs by hand.
|
||||||
//
|
//
|
||||||
|
// NOTE: Wherever possible, let autotools figure this out & define it in config.h
|
||||||
|
// rather than hardcoding it here. If autotools misdefines something, use
|
||||||
|
// core/fixups.h, which is guaranteed to be (re)included right after config.h
|
||||||
|
//
|
||||||
// NB: Programmers are STRONGLY ENCOURAGED not to use the OS detection macros
|
// NB: Programmers are STRONGLY ENCOURAGED not to use the OS detection macros
|
||||||
// or compiler detection marcros directly. Instead they should create
|
// or compiler detection marcros directly. Instead they should create
|
||||||
// macros specific to the task at hand. For example Win32 and Solaris support
|
// macros specific to the task at hand. For example Win32 and Solaris support
|
||||||
|
@ -288,6 +327,8 @@
|
||||||
// int network_order = swap(machine_order);
|
// int network_order = swap(machine_order);
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,26 +369,32 @@
|
||||||
# define WCHAR_IS_16_BITS IS_WIN32
|
# define WCHAR_IS_16_BITS IS_WIN32
|
||||||
# define WCHAR_IS_32_BITS IS_UNIX
|
# define WCHAR_IS_32_BITS IS_UNIX
|
||||||
# define WCHAR_REP_IS_UCS2 IS_WIN32
|
# define WCHAR_REP_IS_UCS2 IS_WIN32
|
||||||
|
|
||||||
|
# define SUPPORTS_POSIX_FORK_EXEC (HAVE_FORK && HAVE_EXEC)
|
||||||
// msystem+mpopen fail on Syllable, so use the libc equivalents until we figure out why.
|
// msystem+mpopen fail on Syllable, so use the libc equivalents until we figure out why.
|
||||||
// TODO: Figure out why.
|
// TODO: Figure out why.
|
||||||
# define USES_MPOPEN (IS_UNIX && !IS_SYLLABLE)
|
# define USES_MPOPEN (SUPPORTS_POSIX_FORK_EXEC && !IS_SYLLABLE)
|
||||||
# define USES_MSYSTEM (IS_UNIX && !IS_SYLLABLE)
|
# define USES_MSYSTEM (SUPPORTS_POSIX_FORK_EXEC && !IS_SYLLABLE)
|
||||||
# define SUPPORTS_WCHART IS_WIN32 // TODO: Remove after getting new ver of KAI
|
# define SUPPORTS_WCHART IS_WIN32 // TODO: Remove after getting new ver of KAI
|
||||||
# define USES_GLIBC ((COMP == COMP_KAI_GLIBC) || HAVE_GCC)
|
# define USES_GLIBC ((COMP == COMP_KAI_GLIBC) || HAVE_GCC)
|
||||||
# define SUPPORTS_MEMBER_TEMPLATES (!IS_SUNPRO)
|
# define SUPPORTS_MEMBER_TEMPLATES (!IS_SUNPRO)
|
||||||
# define SUPPORTS_EXPLICIT_TEMPLATE_FUNC_INST (!IS_SUNPRO)
|
# define SUPPORTS_EXPLICIT_TEMPLATE_FUNC_INST (!IS_SUNPRO)
|
||||||
|
|
||||||
# define SUPPORTS_POSIX_SIGNALS (!IS_DOS_DJGPP)
|
# define SUPPORTS_POSIX_SIGNALS (!IS_DOS_DJGPP)
|
||||||
# define SUPPORTS_NETWORKING (!IS_SORTIX && !IS_DOS_DJGPP && !IS_REDOX)
|
# define SUPPORTS_NETWORKING (HAVE_SOCKET && !IS_SORTIX && !IS_DOS_DJGPP && !IS_REDOX)
|
||||||
# define SUPPORTS_SYSLOG (HAVE_SYSLOG_H && !IS_SKYOS && !IS_RISCOS)
|
# define SUPPORTS_SYSLOG (HAVE_SYSLOG && !IS_SKYOS && !IS_RISCOS)
|
||||||
# define NEEDS_SWAB_IMPL (IS_CYGWIN || 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_MBLEN (!IS_ANDROID && !IS_AROS)
|
||||||
# define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP || IS_RISCOS || IS_REDOX)
|
# define USES_DEVICE_PATH (IS_AROS || IS_DOS_DJGPP || IS_RISCOS || IS_REDOX)
|
||||||
# define ICONV_CONST_SOURCE (IS_MINIX)
|
# define ICONV_CONST_SOURCE (IS_MINIX)
|
||||||
# define SUPPORTS_DIRECT_IO (IS_LINUX)
|
# define SUPPORTS_DIRECT_IO (IS_LINUX)
|
||||||
|
|
||||||
|
# define READ_TAKES_CHAR_PTR (IS_VXWORKS)
|
||||||
|
# define BCOPY_TAKES_CHAR_PTR (IS_VXWORKS)
|
||||||
|
|
||||||
// Linux is the only platform where direct i/o hashing has been tested & works properly so far.
|
// Linux is the only platform where direct i/o hashing has been tested & works properly so far.
|
||||||
|
|
||||||
# define SUPPORTS_TERMIOS (!IS_RTEMS && !IS_REDOX)
|
# define SUPPORTS_TERMIOS (HAVE_TERMIOS_H && (!IS_RTEMS && !IS_REDOX))
|
||||||
// RTEMS errors are probably just a buildsys issue & this will change or go away.
|
// RTEMS errors are probably just a buildsys issue & this will change or go away.
|
||||||
// Redox will probably implement this in the future.
|
// Redox will probably implement this in the future.
|
||||||
|
|
||||||
|
|
|
@ -48,16 +48,16 @@
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#if IS_AROS
|
||||||
|
# undef HAVE_TZSET
|
||||||
|
#endif
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// METHOD CODE
|
// METHOD CODE
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
|
||||||
#define TIME_MAX 2147483647L // largest signed 32 bit number
|
#define TIME_MAX 2147483647L // largest signed 32 bit number
|
||||||
|
|
||||||
#if IS_AROS
|
|
||||||
# define tzset()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct tm* cTimeUtil::TimeToDateGMT(const int64_t& seconds)
|
struct tm* cTimeUtil::TimeToDateGMT(const int64_t& seconds)
|
||||||
{
|
{
|
||||||
ASSERT(seconds < TIME_MAX); // this assumes time_t size is 32 bit. Yikes!
|
ASSERT(seconds < TIME_MAX); // this assumes time_t size is 32 bit. Yikes!
|
||||||
|
@ -69,13 +69,17 @@ struct tm* cTimeUtil::TimeToDateLocal(const int64_t& seconds)
|
||||||
{
|
{
|
||||||
ASSERT(seconds < TIME_MAX); // this assumes time_t size is 32 bit. Yikes!
|
ASSERT(seconds < TIME_MAX); // this assumes time_t size is 32 bit. Yikes!
|
||||||
time_t t = static_cast<time_t>(seconds);
|
time_t t = static_cast<time_t>(seconds);
|
||||||
|
#if HAVE_TZSET
|
||||||
tzset();
|
tzset();
|
||||||
|
#endif
|
||||||
return localtime(&t);
|
return localtime(&t);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t cTimeUtil::DateToTime(struct tm* ptm)
|
int64_t cTimeUtil::DateToTime(struct tm* ptm)
|
||||||
{
|
{
|
||||||
|
#if HAVE_TZSET
|
||||||
tzset();
|
tzset();
|
||||||
|
#endif
|
||||||
return mktime(ptm);
|
return mktime(ptm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,9 @@
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif //HAVE_GCC
|
#endif //HAVE_GCC
|
||||||
|
|
||||||
|
#if IS_AROS
|
||||||
|
# undef HAVE_TZSET
|
||||||
|
#endif
|
||||||
|
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// STANDARD LIBRARY INCLUDES
|
// STANDARD LIBRARY INCLUDES
|
||||||
|
@ -68,10 +71,6 @@ static TSTRING& util_FormatTimeCPlusPlus(struct tm* ptm, TSTRING& strBuf);
|
||||||
// PUBLIC METHOD CODE
|
// PUBLIC METHOD CODE
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
|
||||||
#if IS_AROS
|
|
||||||
# define tzset()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void cTWLocale::InitGlobalLocale()
|
void cTWLocale::InitGlobalLocale()
|
||||||
{
|
{
|
||||||
cDebug d("cTWLocale::InitGlobalLocale");
|
cDebug d("cTWLocale::InitGlobalLocale");
|
||||||
|
@ -239,7 +238,9 @@ TSTRING& cTWLocale::FormatTime(int64_t t, TSTRING& strBuf)
|
||||||
{
|
{
|
||||||
// clear return string
|
// clear return string
|
||||||
strBuf.erase();
|
strBuf.erase();
|
||||||
|
#if HAVE_TZSET
|
||||||
tzset();
|
tzset();
|
||||||
|
#endif
|
||||||
time_t tmpTime = t;
|
time_t tmpTime = t;
|
||||||
struct tm* ptm = localtime(&tmpTime);
|
struct tm* ptm = localtime(&tmpTime);
|
||||||
if (ptm)
|
if (ptm)
|
||||||
|
|
|
@ -54,20 +54,28 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#if HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#ifdef HAVE_SYS_PARAM_H
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_MOUNT_H
|
|
||||||
|
#if HAVE_SYS_MOUNT_H
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_USTAT_H
|
|
||||||
|
#if HAVE_SYS_USTAT_H
|
||||||
#include <sys/ustat.h>
|
#include <sys/ustat.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_WCHAR_H
|
|
||||||
|
#if HAVE_WCHAR_H
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SYS_SYSMACROS_H
|
|
||||||
|
#if HAVE_SYS_SYSMACROS_H
|
||||||
#include <sys/sysmacros.h>
|
#include <sys/sysmacros.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -75,7 +83,9 @@
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_PWD_H
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if IS_REDOX
|
#if IS_REDOX
|
||||||
# define restrict __restrict__
|
# define restrict __restrict__
|
||||||
|
@ -87,7 +97,10 @@
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_GRP_H
|
||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
@ -173,7 +186,7 @@ void cUnixFSServices::GetHostID(TSTRING& name) const
|
||||||
TOSTRINGSTREAM ret;
|
TOSTRINGSTREAM ret;
|
||||||
|
|
||||||
ret.setf(ios_base::hex, ios_base::basefield);
|
ret.setf(ios_base::hex, ios_base::basefield);
|
||||||
#ifdef HAVE_GETHOSTID
|
#if HAVE_GETHOSTID
|
||||||
ret << gethostid();
|
ret << gethostid();
|
||||||
#else
|
#else
|
||||||
ret << 999999;
|
ret << 999999;
|
||||||
|
@ -264,38 +277,41 @@ void cUnixFSServices::GetCurrentDir(TSTRING& strCurDir) const
|
||||||
|
|
||||||
TSTRING& cUnixFSServices::MakeTempFilename(TSTRING& strName) const
|
TSTRING& cUnixFSServices::MakeTempFilename(TSTRING& strName) const
|
||||||
{
|
{
|
||||||
char* pchTempFileName;
|
|
||||||
char szTemplate[iFSServices::TW_MAX_PATH];
|
char szTemplate[iFSServices::TW_MAX_PATH];
|
||||||
int fd;
|
|
||||||
|
|
||||||
strncpy(szTemplate, strName.c_str(), iFSServices::TW_MAX_PATH);
|
strncpy(szTemplate, strName.c_str(), iFSServices::TW_MAX_PATH);
|
||||||
|
|
||||||
#ifdef HAVE_MKSTEMP
|
#if HAVE_MKSTEMP
|
||||||
// create temp filename and check to see if mkstemp failed
|
// create temp filename and check to see if mkstemp failed
|
||||||
if ((fd = mkstemp(szTemplate)) == -1)
|
int fd = mkstemp(szTemplate);
|
||||||
{
|
if (fd < 0)
|
||||||
throw eFSServicesGeneric(strName);
|
throw eFSServicesGeneric(strName);
|
||||||
}
|
|
||||||
else
|
close(fd);
|
||||||
{
|
char* pchTempFileName = szTemplate;
|
||||||
close(fd);
|
|
||||||
}
|
#elif HAVE_MKTEMP
|
||||||
pchTempFileName = szTemplate;
|
|
||||||
#else
|
|
||||||
fd = 0;
|
|
||||||
// create temp filename
|
// create temp filename
|
||||||
pchTempFileName = mktemp(szTemplate);
|
char* pchTempFileName = mktemp(szTemplate);
|
||||||
|
|
||||||
//check to see if mktemp failed
|
//check to see if mktemp failed
|
||||||
if (pchTempFileName == NULL || strlen(pchTempFileName) == 0)
|
if (pchTempFileName == NULL || strlen(pchTempFileName) == 0)
|
||||||
{
|
{
|
||||||
throw eFSServicesGeneric(strName);
|
throw eFSServicesGeneric(strName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif HAVE_TMPNAM
|
||||||
|
char* pchTempFileName = tmpnam(szTemplate);
|
||||||
|
#else
|
||||||
|
// none of the standard temp fns exist? should this be an error?
|
||||||
|
#error "No standard tempfile naming functions are available"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// change name so that it has the XXXXXX part filled in
|
// change name so that it has the XXXXXX part filled in
|
||||||
strName = pchTempFileName;
|
strName = pchTempFileName;
|
||||||
|
|
||||||
|
// TODO: below is a very old comment, is it still accurate?
|
||||||
// Linux creates the file!! Doh!
|
// Linux creates the file!! Doh!
|
||||||
// So I'll always attempt to delete it -bam
|
// So I'll always attempt to delete it -bam
|
||||||
FileDelete(strName.c_str());
|
FileDelete(strName.c_str());
|
||||||
|
@ -310,16 +326,15 @@ void cUnixFSServices::GetTempDirName(TSTRING& strName) const
|
||||||
|
|
||||||
void cUnixFSServices::SetTempDirName(TSTRING& tmpPath)
|
void cUnixFSServices::SetTempDirName(TSTRING& tmpPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
mTempPath = tmpPath;
|
mTempPath = tmpPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !USES_DEVICE_PATH
|
#if !USES_DEVICE_PATH
|
||||||
void cUnixFSServices::Stat(const TSTRING& strName, cFSStatArgs& stat) const
|
void cUnixFSServices::Stat(const TSTRING& strName, cFSStatArgs& statArgs) const
|
||||||
{
|
{
|
||||||
#else
|
#else
|
||||||
void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& stat) const
|
void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& statArgs) const
|
||||||
{
|
{
|
||||||
TSTRING strName = cDevicePath::AsNative(strNameC);
|
TSTRING strName = cDevicePath::AsNative(strNameC);
|
||||||
#endif
|
#endif
|
||||||
|
@ -327,7 +342,11 @@ void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& stat) const
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
|
||||||
int ret;
|
int ret;
|
||||||
|
#if HAVE_LSTAT
|
||||||
ret = lstat(strName.c_str(), &statbuf);
|
ret = lstat(strName.c_str(), &statbuf);
|
||||||
|
#elif HAVE_STAT
|
||||||
|
ret = stat(strName.c_str(), &statbuf);
|
||||||
|
#endif
|
||||||
|
|
||||||
cDebug d("cUnixFSServices::Stat");
|
cDebug d("cUnixFSServices::Stat");
|
||||||
d.TraceDetail("Executing on file %s (result=%d)\n", strName.c_str(), ret);
|
d.TraceDetail("Executing on file %s (result=%d)\n", strName.c_str(), ret);
|
||||||
|
@ -348,66 +367,81 @@ void cUnixFSServices::Stat(const TSTRING& strNameC, cFSStatArgs& stat) const
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//copy information returned by lstat call into the structure passed in
|
//copy information returned by lstat call into the structure passed in
|
||||||
stat.gid = statbuf.st_gid;
|
statArgs.gid = statbuf.st_gid;
|
||||||
stat.atime = statbuf.st_atime;
|
statArgs.atime = statbuf.st_atime;
|
||||||
stat.ctime = statbuf.st_ctime;
|
statArgs.ctime = statbuf.st_ctime;
|
||||||
stat.mtime = statbuf.st_mtime;
|
statArgs.mtime = statbuf.st_mtime;
|
||||||
stat.dev = statbuf.st_dev;
|
statArgs.dev = statbuf.st_dev;
|
||||||
|
|
||||||
#if HAVE_STRUCT_STAT_ST_RDEV
|
#if HAVE_STRUCT_STAT_ST_RDEV
|
||||||
stat.rdev = statbuf.st_rdev;
|
statArgs.rdev = statbuf.st_rdev;
|
||||||
#else
|
#else
|
||||||
stat.rdev = 0;
|
statArgs.rdev = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
stat.ino = statbuf.st_ino;
|
statArgs.ino = statbuf.st_ino;
|
||||||
stat.mode = statbuf.st_mode;
|
statArgs.mode = statbuf.st_mode;
|
||||||
stat.nlink = statbuf.st_nlink;
|
statArgs.nlink = statbuf.st_nlink;
|
||||||
stat.size = statbuf.st_size;
|
statArgs.size = statbuf.st_size;
|
||||||
stat.uid = statbuf.st_uid;
|
statArgs.uid = statbuf.st_uid;
|
||||||
stat.blksize = statbuf.st_blksize;
|
statArgs.blksize = statbuf.st_blksize;
|
||||||
|
|
||||||
#if HAVE_STRUCT_STAT_ST_BLOCKS
|
#if HAVE_STRUCT_STAT_ST_BLOCKS
|
||||||
stat.blocks = statbuf.st_blocks;
|
statArgs.blocks = statbuf.st_blocks;
|
||||||
#else
|
#else
|
||||||
stat.blocks = 0;
|
statArgs.blocks = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set the file type
|
// set the file type
|
||||||
if (S_ISREG(statbuf.st_mode))
|
if (S_ISREG(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_FILE;
|
statArgs.mFileType = cFSStatArgs::TY_FILE;
|
||||||
else if (S_ISDIR(statbuf.st_mode))
|
else if (S_ISDIR(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_DIR;
|
statArgs.mFileType = cFSStatArgs::TY_DIR;
|
||||||
else if (S_ISLNK(statbuf.st_mode))
|
else if (S_ISLNK(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_SYMLINK;
|
statArgs.mFileType = cFSStatArgs::TY_SYMLINK;
|
||||||
else if (S_ISBLK(statbuf.st_mode))
|
else if (S_ISBLK(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_BLOCKDEV;
|
statArgs.mFileType = cFSStatArgs::TY_BLOCKDEV;
|
||||||
else if (S_ISCHR(statbuf.st_mode))
|
else if (S_ISCHR(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_CHARDEV;
|
statArgs.mFileType = cFSStatArgs::TY_CHARDEV;
|
||||||
else if (S_ISFIFO(statbuf.st_mode))
|
else if (S_ISFIFO(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_FIFO;
|
statArgs.mFileType = cFSStatArgs::TY_FIFO;
|
||||||
#ifdef S_ISSOCK
|
#ifdef S_ISSOCK
|
||||||
else if (S_ISSOCK(statbuf.st_mode))
|
else if (S_ISSOCK(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_SOCK;
|
statArgs.mFileType = cFSStatArgs::TY_SOCK;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_DOOR_CREATE
|
#if HAVE_DOOR_CREATE
|
||||||
else if (S_ISDOOR(statbuf.st_mode))
|
else if (S_ISDOOR(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_DOOR;
|
statArgs.mFileType = cFSStatArgs::TY_DOOR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_PORT_CREATE
|
#if HAVE_PORT_CREATE
|
||||||
else if (S_ISPORT(statbuf.st_mode))
|
else if (S_ISPORT(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_PORT;
|
statArgs.mFileType = cFSStatArgs::TY_PORT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef S_ISNAM
|
#ifdef S_ISNAM
|
||||||
else if (S_ISNAM(statbuf.st_mode))
|
else if (S_ISNAM(statbuf.st_mode))
|
||||||
stat.mFileType = cFSStatArgs::TY_NAMED;
|
statArgs.mFileType = cFSStatArgs::TY_NAMED;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef S_TYPEISMQ
|
||||||
|
else if (S_TYPEISMQ(&statbuf))
|
||||||
|
statArgs.mFileType = cFSStatArgs::TY_MESSAGE_QUEUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef S_TYPEISSEM
|
||||||
|
else if (S_TYPEISSEM(&statbuf))
|
||||||
|
statArgs.mFileType = cFSStatArgs::TY_SEMAPHORE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef S_TYPEISSHM
|
||||||
|
else if (S_TYPEISSHM(&statbuf))
|
||||||
|
statArgs.mFileType = cFSStatArgs::TY_SHARED_MEMORY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else
|
else
|
||||||
stat.mFileType = cFSStatArgs::TY_INVALID;
|
statArgs.mFileType = cFSStatArgs::TY_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cUnixFSServices::GetMachineName(TSTRING& strName) const
|
void cUnixFSServices::GetMachineName(TSTRING& strName) const
|
||||||
|
@ -461,8 +495,8 @@ bool cUnixFSServices::FileDelete(const TSTRING& strName) const
|
||||||
|
|
||||||
bool cUnixFSServices::GetCurrentUserName(TSTRING& strName) const
|
bool cUnixFSServices::GetCurrentUserName(TSTRING& strName) const
|
||||||
{
|
{
|
||||||
|
#if HAVE_PWD_H
|
||||||
bool fSuccess = false;
|
bool fSuccess = false;
|
||||||
|
|
||||||
uid_t uid = getuid();
|
uid_t uid = getuid();
|
||||||
struct passwd* pp = getpwuid(uid);
|
struct passwd* pp = getpwuid(uid);
|
||||||
|
|
||||||
|
@ -475,6 +509,10 @@ bool cUnixFSServices::GetCurrentUserName(TSTRING& strName) const
|
||||||
strName = _T("");
|
strName = _T("");
|
||||||
|
|
||||||
return (fSuccess);
|
return (fSuccess);
|
||||||
|
#else
|
||||||
|
strName = _T("");
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -537,6 +575,7 @@ bool cUnixFSServices::GetUserName(uid_t user_id, TSTRING& tstrUser) const
|
||||||
{
|
{
|
||||||
bool fSuccess = true;
|
bool fSuccess = true;
|
||||||
|
|
||||||
|
#if HAVE_PWD_H
|
||||||
if (mResolveNames)
|
if (mResolveNames)
|
||||||
{
|
{
|
||||||
struct passwd* pp = getpwuid(user_id);
|
struct passwd* pp = getpwuid(user_id);
|
||||||
|
@ -550,11 +589,13 @@ bool cUnixFSServices::GetUserName(uid_t user_id, TSTRING& tstrUser) const
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
std::stringstream sstr;
|
std::stringstream sstr;
|
||||||
sstr << user_id;
|
sstr << user_id;
|
||||||
tstrUser = sstr.str();
|
tstrUser = sstr.str();
|
||||||
|
#if HAVE_PWD_H
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return (fSuccess);
|
return (fSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,7 +604,7 @@ bool cUnixFSServices::GetGroupName(gid_t group_id, TSTRING& tstrGroup) const
|
||||||
{
|
{
|
||||||
bool fSuccess = true;
|
bool fSuccess = true;
|
||||||
|
|
||||||
#if !IS_REDOX
|
#if !IS_REDOX && HAVE_GRP_H
|
||||||
if (mResolveNames)
|
if (mResolveNames)
|
||||||
{
|
{
|
||||||
struct group* pg = getgrgid(group_id);
|
struct group* pg = getgrgid(group_id);
|
||||||
|
@ -581,7 +622,7 @@ bool cUnixFSServices::GetGroupName(gid_t group_id, TSTRING& tstrGroup) const
|
||||||
std::stringstream sstr;
|
std::stringstream sstr;
|
||||||
sstr << group_id;
|
sstr << group_id;
|
||||||
tstrGroup = sstr.str();
|
tstrGroup = sstr.str();
|
||||||
#if !IS_REDOX
|
#if !IS_REDOX && HAVE_GRP_H
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -520,8 +520,14 @@ void cMD5Signature::Finit()
|
||||||
MD5_Final(md5_digest, &mMD5Info);
|
MD5_Final(md5_digest, &mMD5Info);
|
||||||
#else
|
#else
|
||||||
MD5Final(&mMD5Info);
|
MD5Final(&mMD5Info);
|
||||||
|
|
||||||
|
#if BCOPY_TAKES_CHAR_PTR
|
||||||
|
bcopy((char*)mMD5Info.digest, (char*)md5_digest, MD5_DIGEST_LENGTH);
|
||||||
|
#else
|
||||||
bcopy(mMD5Info.digest, md5_digest, MD5_DIGEST_LENGTH);
|
bcopy(mMD5Info.digest, md5_digest, MD5_DIGEST_LENGTH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -274,6 +274,15 @@ bool cFSDataSourceIter::InitializeTypeInfo(iFCO* pFCO)
|
||||||
case cFSStatArgs::TY_NAMED:
|
case cFSStatArgs::TY_NAMED:
|
||||||
propSet.SetFileType(cFSPropSet::FT_NAMED);
|
propSet.SetFileType(cFSPropSet::FT_NAMED);
|
||||||
break;
|
break;
|
||||||
|
case cFSStatArgs::TY_MESSAGE_QUEUE:
|
||||||
|
propSet.SetFileType(cFSPropSet::FT_MESSAGE_QUEUE);
|
||||||
|
break;
|
||||||
|
case cFSStatArgs::TY_SEMAPHORE:
|
||||||
|
propSet.SetFileType(cFSPropSet::FT_SEMAPHORE);
|
||||||
|
break;
|
||||||
|
case cFSStatArgs::TY_SHARED_MEMORY:
|
||||||
|
propSet.SetFileType(cFSPropSet::FT_SHARED_MEMORY);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// set it to invalid
|
// set it to invalid
|
||||||
propSet.SetFileType(cFSPropSet::FT_INVALID);
|
propSet.SetFileType(cFSPropSet::FT_INVALID);
|
||||||
|
|
|
@ -78,6 +78,9 @@ static bool NeedsStat(const cFCOPropVector& v)
|
||||||
|
|
||||||
bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t size)
|
bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t size)
|
||||||
{
|
{
|
||||||
|
#if !HAVE_READLINK
|
||||||
|
return false;
|
||||||
|
#else
|
||||||
std::vector<char> data(size + 1);
|
std::vector<char> data(size + 1);
|
||||||
char* buf = &data[0];
|
char* buf = &data[0];
|
||||||
|
|
||||||
|
@ -118,6 +121,7 @@ bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t s
|
||||||
arch.WriteBlob(buf, rtn);
|
arch.WriteBlob(buf, rtn);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void cFSPropCalc::AddPropCalcError(const eError& e)
|
void cFSPropCalc::AddPropCalcError(const eError& e)
|
||||||
|
@ -298,6 +302,15 @@ void cFSPropCalc::HandleStatProperties(const cFCOPropVector& propsToCheck, const
|
||||||
case cFSStatArgs::TY_NAMED:
|
case cFSStatArgs::TY_NAMED:
|
||||||
propSet.SetFileType(cFSPropSet::FT_NAMED);
|
propSet.SetFileType(cFSPropSet::FT_NAMED);
|
||||||
break;
|
break;
|
||||||
|
case cFSStatArgs::TY_MESSAGE_QUEUE:
|
||||||
|
propSet.SetFileType(cFSPropSet::FT_MESSAGE_QUEUE);
|
||||||
|
break;
|
||||||
|
case cFSStatArgs::TY_SEMAPHORE:
|
||||||
|
propSet.SetFileType(cFSPropSet::FT_SEMAPHORE);
|
||||||
|
break;
|
||||||
|
case cFSStatArgs::TY_SHARED_MEMORY:
|
||||||
|
propSet.SetFileType(cFSPropSet::FT_SHARED_MEMORY);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
// set it to invalid
|
// set it to invalid
|
||||||
propSet.SetFileType(cFSPropSet::FT_INVALID);
|
propSet.SetFileType(cFSPropSet::FT_INVALID);
|
||||||
|
|
|
@ -59,7 +59,10 @@ TSTRING cFCOPropFileType::AsString() const
|
||||||
fs::STR_FT_SOCK,
|
fs::STR_FT_SOCK,
|
||||||
fs::STR_FT_DOOR,
|
fs::STR_FT_DOOR,
|
||||||
fs::STR_FT_PORT,
|
fs::STR_FT_PORT,
|
||||||
fs::STR_FT_NAMED};
|
fs::STR_FT_NAMED,
|
||||||
|
fs::STR_FT_MESSAGE_QUEUE,
|
||||||
|
fs::STR_FT_SEMAPHORE,
|
||||||
|
fs::STR_FT_SHARED_MEMORY};
|
||||||
|
|
||||||
int32_t fileType = GetValue();
|
int32_t fileType = GetValue();
|
||||||
if ((fileType > cFSPropSet::FT_INVALID) && (fileType < cFSPropSet::FT_NUMITEMS))
|
if ((fileType > cFSPropSet::FT_INVALID) && (fileType < cFSPropSet::FT_NUMITEMS))
|
||||||
|
|
|
@ -112,6 +112,9 @@ public:
|
||||||
FT_DOOR,
|
FT_DOOR,
|
||||||
FT_PORT,
|
FT_PORT,
|
||||||
FT_NAMED,
|
FT_NAMED,
|
||||||
|
FT_MESSAGE_QUEUE,
|
||||||
|
FT_SEMAPHORE,
|
||||||
|
FT_SHARED_MEMORY,
|
||||||
FT_NUMITEMS
|
FT_NUMITEMS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,12 +42,19 @@
|
||||||
TSS_BeginStringtable(cFS)
|
TSS_BeginStringtable(cFS)
|
||||||
|
|
||||||
TSS_StringEntry(fs::STR_FT_INVALID, _T("Invalid")),
|
TSS_StringEntry(fs::STR_FT_INVALID, _T("Invalid")),
|
||||||
TSS_StringEntry(fs::STR_FT_FILE, _T("Regular File")), TSS_StringEntry(fs::STR_FT_DIR, _T("Directory")),
|
TSS_StringEntry(fs::STR_FT_FILE, _T("Regular File")),
|
||||||
|
TSS_StringEntry(fs::STR_FT_DIR, _T("Directory")),
|
||||||
TSS_StringEntry(fs::STR_FT_BLOCKDEV, _T("Block Device")),
|
TSS_StringEntry(fs::STR_FT_BLOCKDEV, _T("Block Device")),
|
||||||
TSS_StringEntry(fs::STR_FT_CHARDEV, _T("Character Device")),
|
TSS_StringEntry(fs::STR_FT_CHARDEV, _T("Character Device")),
|
||||||
TSS_StringEntry(fs::STR_FT_SYMLINK, _T("Symbolic Link")), TSS_StringEntry(fs::STR_FT_FIFO, _T("FIFO")),
|
TSS_StringEntry(fs::STR_FT_SYMLINK, _T("Symbolic Link")),
|
||||||
TSS_StringEntry(fs::STR_FT_SOCK, _T("Socket")), TSS_StringEntry(fs::STR_FT_DOOR, _T("Door")),
|
TSS_StringEntry(fs::STR_FT_FIFO, _T("FIFO")),
|
||||||
TSS_StringEntry(fs::STR_FT_PORT, _T("Event Port")), TSS_StringEntry(fs::STR_FT_NAMED, _T("Named Special File")),
|
TSS_StringEntry(fs::STR_FT_SOCK, _T("Socket")),
|
||||||
|
TSS_StringEntry(fs::STR_FT_DOOR, _T("Door")),
|
||||||
|
TSS_StringEntry(fs::STR_FT_PORT, _T("Event Port")),
|
||||||
|
TSS_StringEntry(fs::STR_FT_NAMED, _T("Named Special File")),
|
||||||
|
TSS_StringEntry(fs::STR_FT_MESSAGE_QUEUE, _T("Message Queue")),
|
||||||
|
TSS_StringEntry(fs::STR_FT_SEMAPHORE, _T("Semaphore")),
|
||||||
|
TSS_StringEntry(fs::STR_FT_SHARED_MEMORY, _T("Shared Memory")),
|
||||||
|
|
||||||
// property names
|
// property names
|
||||||
TSS_StringEntry(fs::STR_PROP_DEV, _T("Device Number")),
|
TSS_StringEntry(fs::STR_PROP_DEV, _T("Device Number")),
|
||||||
|
|
|
@ -46,9 +46,8 @@ TSS_BeginStringIds(fs)
|
||||||
|
|
||||||
// file types
|
// file types
|
||||||
STR_FT_INVALID,
|
STR_FT_INVALID,
|
||||||
STR_FT_FILE, STR_FT_DIR, STR_FT_BLOCKDEV, STR_FT_CHARDEV, STR_FT_SYMLINK, STR_FT_FIFO, STR_FT_SOCK, STR_FT_DOOR,
|
STR_FT_FILE, STR_FT_DIR, STR_FT_BLOCKDEV, STR_FT_CHARDEV, STR_FT_SYMLINK, STR_FT_FIFO, STR_FT_SOCK, STR_FT_DOOR, STR_FT_PORT, STR_FT_NAMED,
|
||||||
STR_FT_PORT, STR_FT_NAMED,
|
STR_FT_MESSAGE_QUEUE, STR_FT_SEMAPHORE, STR_FT_SHARED_MEMORY,
|
||||||
|
|
||||||
// property names
|
// property names
|
||||||
STR_PROP_DEV, STR_PROP_RDEV, STR_PROP_INODE, STR_PROP_MODE, STR_PROP_NLINK, STR_PROP_UID, STR_PROP_GID,
|
STR_PROP_DEV, STR_PROP_RDEV, STR_PROP_INODE, STR_PROP_MODE, STR_PROP_NLINK, STR_PROP_UID, STR_PROP_GID,
|
||||||
STR_PROP_SIZE, STR_PROP_ATIME, STR_PROP_MTIME, STR_PROP_CTIME, STR_PROP_BLOCK_SIZE, STR_PROP_BLOCKS, STR_PROP_CRC32,
|
STR_PROP_SIZE, STR_PROP_ATIME, STR_PROP_MTIME, STR_PROP_CTIME, STR_PROP_BLOCK_SIZE, STR_PROP_BLOCKS, STR_PROP_CRC32,
|
||||||
|
|
|
@ -64,14 +64,22 @@
|
||||||
void tw_terminate_handler()
|
void tw_terminate_handler()
|
||||||
{
|
{
|
||||||
fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr);
|
fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr);
|
||||||
|
#if HAVE__EXIT
|
||||||
_exit(1);
|
_exit(1);
|
||||||
|
#else
|
||||||
|
exit(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus < 201703L
|
#if __cplusplus < 201703L
|
||||||
void tw_unexpected_handler()
|
void tw_unexpected_handler()
|
||||||
{
|
{
|
||||||
fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr);
|
fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr);
|
||||||
|
#if HAVE__EXIT
|
||||||
_exit(1);
|
_exit(1);
|
||||||
|
#else
|
||||||
|
exit(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -153,11 +153,13 @@ void cPipedMailMessage::SendInit() // throw( eMailMessageError )
|
||||||
TSTRING strHeader;
|
TSTRING strHeader;
|
||||||
strHeader += cStringUtil::StrToTstr(cMailMessage::Create822Header());
|
strHeader += cStringUtil::StrToTstr(cMailMessage::Create822Header());
|
||||||
|
|
||||||
#if !USES_MPOPEN
|
#if USES_MPOPEN
|
||||||
mpFile = popen(mstrSendMailExePath.c_str(), _T("w"));
|
|
||||||
#else
|
|
||||||
// call mpopen, our safe version popen
|
// call mpopen, our safe version popen
|
||||||
mpFile = mpopen((char*)mstrSendMailExePath.c_str(), _T("w"));
|
mpFile = mpopen((char*)mstrSendMailExePath.c_str(), _T("w"));
|
||||||
|
#elif HAVE_POPEN
|
||||||
|
mpFile = popen(mstrSendMailExePath.c_str(), _T("w"));
|
||||||
|
#else
|
||||||
|
// No pipes for you, sorry.
|
||||||
#endif
|
#endif
|
||||||
if (!mpFile)
|
if (!mpFile)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,22 +45,27 @@
|
||||||
|
|
||||||
//All the spleck that it takes to run sockets in Unix...
|
//All the spleck that it takes to run sockets in Unix...
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
# if HAVE_SYS_SOCKET_H
|
|
||||||
# include <sys/socket.h>
|
#if HAVE_SYS_SOCKET_H
|
||||||
# include <netdb.h>
|
# include <sys/socket.h>
|
||||||
# include <netinet/in.h>
|
# include <netdb.h>
|
||||||
# include <arpa/inet.h>
|
# include <netinet/in.h>
|
||||||
# endif
|
# include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
# if HAVE_SYS_UTSNAME_H
|
#if HAVE_SYS_TIME_H
|
||||||
# include <sys/utsname.h>
|
# include <sys/time.h>
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# if HAVE_SYS_SELECT_H
|
#if HAVE_SYS_UTSNAME_H
|
||||||
# include <sys/select.h>
|
# include <sys/utsname.h>
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_SYS_SELECT_H
|
||||||
|
# include <sys/select.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Some systems like Solaris and AIX don't define
|
/* Some systems like Solaris and AIX don't define
|
||||||
* INADDR_NONE, but it's pretty standard. If not,
|
* INADDR_NONE, but it's pretty standard. If not,
|
||||||
|
|
|
@ -37,11 +37,11 @@
|
||||||
#include "syslog_trip.h"
|
#include "syslog_trip.h"
|
||||||
|
|
||||||
#if HAVE_SYSLOG_H
|
#if HAVE_SYSLOG_H
|
||||||
#include <syslog.h>
|
# include <syslog.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_SYS_SYSLOG_H
|
#if HAVE_SYS_SYSLOG_H
|
||||||
#include <sys/syslog.h>
|
# include <sys/syslog.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// next three includes are for error reporting
|
// next three includes are for error reporting
|
||||||
|
@ -49,10 +49,11 @@
|
||||||
#include "tw/twerrors.h"
|
#include "tw/twerrors.h"
|
||||||
#include "tw/twstrings.h"
|
#include "tw/twstrings.h"
|
||||||
|
|
||||||
|
// TODO: Handle this in a proper autoconf way
|
||||||
#if IS_AROS
|
#if IS_AROS
|
||||||
#include <proto/bsdsocket.h>
|
# include <proto/bsdsocket.h>
|
||||||
# define openlog(a, b, c)
|
# define openlog(a, b, c)
|
||||||
# define closelog()
|
# define closelog()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -92,14 +92,23 @@ void operator delete(void* addr)
|
||||||
void tw_terminate_handler()
|
void tw_terminate_handler()
|
||||||
{
|
{
|
||||||
fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr);
|
fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr);
|
||||||
|
#if HAVE__EXIT
|
||||||
_exit(8);
|
_exit(8);
|
||||||
|
#else
|
||||||
|
exit(8);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus < 201703L
|
#if __cplusplus < 201703L
|
||||||
void tw_unexpected_handler()
|
void tw_unexpected_handler()
|
||||||
{
|
{
|
||||||
fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr);
|
fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr);
|
||||||
|
|
||||||
|
#if HAVE__EXIT
|
||||||
_exit(8);
|
_exit(8);
|
||||||
|
#else
|
||||||
|
exit(8);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct tGK
|
||||||
|
|
||||||
enum ReturnValue
|
enum ReturnValue
|
||||||
{
|
{
|
||||||
OK = 0,
|
OKAY = 0,
|
||||||
INVALIDPARAM = 1,
|
INVALIDPARAM = 1,
|
||||||
GENERATION_ERROR = 2,
|
GENERATION_ERROR = 2,
|
||||||
FILE_WRITE_ERROR = 3,
|
FILE_WRITE_ERROR = 3,
|
||||||
|
@ -123,7 +123,7 @@ static void GeneratePublicPrivateKeys(void* pParams, const cElGamalSig::KeySize
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pGK->retValue = tGK::OK;
|
pGK->retValue = tGK::OKAY;
|
||||||
pGK->doneFlag = true;
|
pGK->doneFlag = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ bool GenerateKey(const TCHAR* keyPath, wc16_string passphrase, const cElGamalSig
|
||||||
|
|
||||||
GeneratePublicPrivateKeys(&gk, key_size);
|
GeneratePublicPrivateKeys(&gk, key_size);
|
||||||
|
|
||||||
if (gk.retValue != tGK::OK)
|
if (gk.retValue != tGK::OKAY)
|
||||||
{
|
{
|
||||||
switch (gk.retValue)
|
switch (gk.retValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// terminate and unexpected handlers
|
// terminate and unexpected handlers
|
||||||
// TODO: move these to a common library
|
// TODO: move these to a common library
|
||||||
|
@ -58,14 +59,22 @@
|
||||||
void tw_terminate_handler()
|
void tw_terminate_handler()
|
||||||
{
|
{
|
||||||
fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr);
|
fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr);
|
||||||
|
#if HAVE__EXIT
|
||||||
_exit(1);
|
_exit(1);
|
||||||
|
#else
|
||||||
|
exit(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __cplusplus < 201703L
|
#if __cplusplus < 201703L
|
||||||
void tw_unexpected_handler()
|
void tw_unexpected_handler()
|
||||||
{
|
{
|
||||||
fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr);
|
fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr);
|
||||||
|
#if HAVE__EXIT
|
||||||
_exit(1);
|
_exit(1);
|
||||||
|
#else
|
||||||
|
exit(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1197,12 +1197,12 @@ cHashedKey128::cHashedKey128(const TSTRING& data)
|
||||||
sha.CalculateDigest((uint8_t*)mKey, (uint8_t*)data.data(), data.length() * sizeof(TCHAR));
|
sha.CalculateDigest((uint8_t*)mKey, (uint8_t*)data.data(), data.length() * sizeof(TCHAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
cHashedKey128::cHashedKey128(void* pData, int dataLen)
|
cHashedKey128::cHashedKey128(void* pData, int32_t dataLen)
|
||||||
{
|
{
|
||||||
SHA sha;
|
SHA sha;
|
||||||
|
|
||||||
ASSERT(SHA::DIGESTSIZE >= KEYLEN);
|
ASSERT(SHA::DIGESTSIZE >= KEYLEN);
|
||||||
ASSERT(SHA::DIGESTSIZE <= BUFSIZE);
|
ASSERT(SHA::DIGESTSIZE <= BUFFER_SIZE);
|
||||||
sha.CalculateDigest((uint8_t*)mKey, (uint8_t*)pData, dataLen);
|
sha.CalculateDigest((uint8_t*)mKey, (uint8_t*)pData, dataLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,7 +1227,7 @@ cHashedKey192::cHashedKey192(const TSTRING& data)
|
||||||
memcpy(mKey, localKey, KEYLEN);
|
memcpy(mKey, localKey, KEYLEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
cHashedKey192::cHashedKey192(void* pData, int dataLen)
|
cHashedKey192::cHashedKey192(void* pData, int32_t dataLen)
|
||||||
{
|
{
|
||||||
SHA sha;
|
SHA sha;
|
||||||
|
|
||||||
|
|
|
@ -350,7 +350,7 @@ class cHashedKey128
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit cHashedKey128(const TSTRING& data);
|
explicit cHashedKey128(const TSTRING& data);
|
||||||
cHashedKey128(void* pData, int dataLen);
|
cHashedKey128(void* pData, int32_t dataLen);
|
||||||
~cHashedKey128();
|
~cHashedKey128();
|
||||||
|
|
||||||
const int8_t* GetKey() const;
|
const int8_t* GetKey() const;
|
||||||
|
@ -362,10 +362,10 @@ protected:
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
KEYLEN = 16,
|
KEYLEN = 16,
|
||||||
BUFSIZE = 20
|
BUFFER_SIZE = 20
|
||||||
};
|
};
|
||||||
|
|
||||||
int8_t mKey[BUFSIZE];
|
int8_t mKey[BUFFER_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
inline const int8_t* cHashedKey128::GetKey() const
|
inline const int8_t* cHashedKey128::GetKey() const
|
||||||
|
|
|
@ -67,7 +67,11 @@
|
||||||
void tw_terminate_handler()
|
void tw_terminate_handler()
|
||||||
{
|
{
|
||||||
fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr);
|
fputs("### Internal Error.\n### Terminate Handler called.\n### Exiting...\n", stderr);
|
||||||
|
#if HAVE__EXIT
|
||||||
_exit(1);
|
_exit(1);
|
||||||
|
#else
|
||||||
|
exit(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exception specifications removed as a misfeature in C++17
|
// Exception specifications removed as a misfeature in C++17
|
||||||
|
@ -75,7 +79,12 @@ void tw_terminate_handler()
|
||||||
void tw_unexpected_handler()
|
void tw_unexpected_handler()
|
||||||
{
|
{
|
||||||
fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr);
|
fputs("### Internal Error.\n### Unexpected Exception Handler called.\n### Exiting...\n", stderr);
|
||||||
|
|
||||||
|
#if HAVE__EXIT
|
||||||
_exit(1);
|
_exit(1);
|
||||||
|
#else
|
||||||
|
exit(1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,10 @@ void TestCrypto()
|
||||||
{
|
{
|
||||||
const int COUNT = 4000;
|
const int COUNT = 4000;
|
||||||
|
|
||||||
const int BUFSIZE = 9000;
|
const int BUFFER_SIZE = 9000;
|
||||||
|
|
||||||
std::vector<char> source_buf(BUFSIZE);
|
std::vector<char> source_buf(BUFFER_SIZE);
|
||||||
std::vector<char> crypt_buf(COUNT + BUFSIZE); // needs to be able to hold even number of blocks
|
std::vector<char> crypt_buf(COUNT + BUFFER_SIZE); // needs to be able to hold even number of blocks
|
||||||
std::vector<char> dest_buf(COUNT);
|
std::vector<char> dest_buf(COUNT);
|
||||||
|
|
||||||
char* source = &source_buf[0];
|
char* source = &source_buf[0];
|
||||||
|
@ -119,9 +119,9 @@ void TestCrypto()
|
||||||
|
|
||||||
// we use buf for when the end of the source doesn't fall on a
|
// we use buf for when the end of the source doesn't fall on a
|
||||||
// blocksize boundry.
|
// blocksize boundry.
|
||||||
TEST(crypter.GetBlockSizePlain() < BUFSIZE);
|
TEST(crypter.GetBlockSizePlain() < BUFFER_SIZE);
|
||||||
TEST(crypter.GetBlockSizeCipher() < BUFSIZE);
|
TEST(crypter.GetBlockSizeCipher() < BUFFER_SIZE);
|
||||||
char buf[BUFSIZE];
|
char buf[BUFFER_SIZE];
|
||||||
|
|
||||||
cRSAPublicKey* pPublic;
|
cRSAPublicKey* pPublic;
|
||||||
cRSAPrivateKey* pPrivate;
|
cRSAPrivateKey* pPrivate;
|
||||||
|
@ -132,16 +132,16 @@ void TestCrypto()
|
||||||
cRSAPublicKey* pPublic2;
|
cRSAPublicKey* pPublic2;
|
||||||
cRSAPrivateKey* pPrivate2;
|
cRSAPrivateKey* pPrivate2;
|
||||||
|
|
||||||
TEST(pPublic->GetWriteLen() < BUFSIZE);
|
TEST(pPublic->GetWriteLen() < BUFFER_SIZE);
|
||||||
pPublic->Write(buf);
|
pPublic->Write(buf);
|
||||||
pPublic2 = new cRSAPublicKey(buf);
|
pPublic2 = new cRSAPublicKey(buf);
|
||||||
|
|
||||||
TEST(pPrivate->GetWriteLen() < BUFSIZE);
|
TEST(pPrivate->GetWriteLen() < BUFFER_SIZE);
|
||||||
pPrivate->Write(buf);
|
pPrivate->Write(buf);
|
||||||
pPrivate2 = new cRSAPrivateKey(buf);
|
pPrivate2 = new cRSAPrivateKey(buf);
|
||||||
|
|
||||||
// we will try encrypting to a second pair of buffers and see if all goes well
|
// we will try encrypting to a second pair of buffers and see if all goes well
|
||||||
char crypt2[COUNT + BUFSIZE];
|
char crypt2[COUNT + BUFFER_SIZE];
|
||||||
char dest2[COUNT];
|
char dest2[COUNT];
|
||||||
|
|
||||||
// encrypt the phrase
|
// encrypt the phrase
|
||||||
|
@ -289,9 +289,9 @@ void TestCrypto()
|
||||||
|
|
||||||
// we use buf for when the end of the source doesn't fall on a
|
// we use buf for when the end of the source doesn't fall on a
|
||||||
// blocksize boundry.
|
// blocksize boundry.
|
||||||
TEST(crypter.GetBlockSizePlain() < BUFSIZE);
|
TEST(crypter.GetBlockSizePlain() < BUFFER_SIZE);
|
||||||
TEST(crypter.GetBlockSizeCipher() < BUFSIZE);
|
TEST(crypter.GetBlockSizeCipher() < BUFFER_SIZE);
|
||||||
char buf[BUFSIZE];
|
char buf[BUFFER_SIZE];
|
||||||
|
|
||||||
cElGamalSigPublicKey* pPublic;
|
cElGamalSigPublicKey* pPublic;
|
||||||
cElGamalSigPrivateKey* pPrivate;
|
cElGamalSigPrivateKey* pPrivate;
|
||||||
|
@ -302,16 +302,16 @@ void TestCrypto()
|
||||||
cElGamalSigPublicKey* pPublic2;
|
cElGamalSigPublicKey* pPublic2;
|
||||||
cElGamalSigPrivateKey* pPrivate2;
|
cElGamalSigPrivateKey* pPrivate2;
|
||||||
|
|
||||||
TEST(pPublic->GetWriteLen() < BUFSIZE);
|
TEST(pPublic->GetWriteLen() < BUFFER_SIZE);
|
||||||
pPublic->Write(buf);
|
pPublic->Write(buf);
|
||||||
pPublic2 = new cElGamalSigPublicKey(buf);
|
pPublic2 = new cElGamalSigPublicKey(buf);
|
||||||
|
|
||||||
TEST(pPrivate->GetWriteLen() < BUFSIZE);
|
TEST(pPrivate->GetWriteLen() < BUFFER_SIZE);
|
||||||
pPrivate->Write(buf);
|
pPrivate->Write(buf);
|
||||||
pPrivate2 = new cElGamalSigPrivateKey(buf);
|
pPrivate2 = new cElGamalSigPrivateKey(buf);
|
||||||
|
|
||||||
// we will try encrypting to a second pair of buffers and see if all goes well
|
// we will try encrypting to a second pair of buffers and see if all goes well
|
||||||
//char crypt2[COUNT + BUFSIZE];
|
//char crypt2[COUNT + BUFFER_SIZE];
|
||||||
//char dest2[COUNT];
|
//char dest2[COUNT];
|
||||||
|
|
||||||
// zero out things and try signing and verifying
|
// zero out things and try signing and verifying
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// PrintProps -- prints out all the valid property names and values as pairs...
|
// PrintProps -- prints out all the valid property names and values as pairs...
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -140,6 +141,7 @@ void TestFSPropCalc()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_SYMLINK
|
||||||
void TestGetSymLinkStr()
|
void TestGetSymLinkStr()
|
||||||
{
|
{
|
||||||
std::string file = TwTestPath("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
|
std::string file = TwTestPath("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
|
||||||
|
@ -156,9 +158,12 @@ void TestGetSymLinkStr()
|
||||||
TEST(cFSPropCalc::GetSymLinkStr(link, arch, 8));
|
TEST(cFSPropCalc::GetSymLinkStr(link, arch, 8));
|
||||||
TEST(arch.Length() == (int64_t)file.size());
|
TEST(arch.Length() == (int64_t)file.size());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void RegisterSuite_FSPropCalc()
|
void RegisterSuite_FSPropCalc()
|
||||||
{
|
{
|
||||||
RegisterTest("FSPropCalc", "Basic", TestFSPropCalc);
|
RegisterTest("FSPropCalc", "Basic", TestFSPropCalc);
|
||||||
|
#if HAVE_SYMLINK
|
||||||
RegisterTest("FSPropCalc", "GetSymLinkStr", TestGetSymLinkStr);
|
RegisterTest("FSPropCalc", "GetSymLinkStr", TestGetSymLinkStr);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,12 +75,17 @@ void TestTWUtil()
|
||||||
TEST(cFileUtil::FileWritable(tmpFN) == true)
|
TEST(cFileUtil::FileWritable(tmpFN) == true)
|
||||||
TEST(cFileUtil::FileExists(tmpFN) == false);
|
TEST(cFileUtil::FileExists(tmpFN) == false);
|
||||||
|
|
||||||
|
#if !HAVE_GETUID
|
||||||
|
bool is_root = true;
|
||||||
|
#else
|
||||||
|
|
||||||
#if IS_AROS
|
#if IS_AROS
|
||||||
bool is_root = (65534 == getuid()); //AROS doesn't really have users, & posixy fns use this pseudo value.
|
bool is_root = (65534 == getuid()); //AROS doesn't really have users, & posixy fns use this pseudo value.
|
||||||
#else
|
#else
|
||||||
bool is_root = (0 == getuid());
|
bool is_root = (0 == getuid());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
// make the dir read only and make sure write tests false
|
// make the dir read only and make sure write tests false
|
||||||
// windows fails this test, perhaps because I am an administrator?
|
// windows fails this test, perhaps because I am an administrator?
|
||||||
// chmod(tmpDir.c_str(), 0500);
|
// chmod(tmpDir.c_str(), 0500);
|
||||||
|
|
|
@ -52,7 +52,6 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// TestFileExists
|
// TestFileExists
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -264,8 +263,13 @@ bool cFileUtil::Copy(const TSTRING& src_path, const TSTRING& dest_path)
|
||||||
|
|
||||||
// restore permissions and ownership
|
// restore permissions and ownership
|
||||||
// don't worry if it fails. it's not mission-critical.
|
// don't worry if it fails. it's not mission-critical.
|
||||||
|
#if HAVE_CHMOD
|
||||||
chmod(dest_path.c_str(), srcStat.st_mode);
|
chmod(dest_path.c_str(), srcStat.st_mode);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAVE_CHOWN
|
||||||
chown(dest_path.c_str(), srcStat.st_uid, srcStat.st_gid);
|
chown(dest_path.c_str(), srcStat.st_uid, srcStat.st_gid);
|
||||||
|
#endif
|
||||||
|
|
||||||
srcFile.Close();
|
srcFile.Close();
|
||||||
destFile.Close();
|
destFile.Close();
|
||||||
|
|
Loading…
Reference in New Issue