From 45c9aa137e7457df867f26d8d11060c05103d301 Mon Sep 17 00:00:00 2001 From: antona Date: Wed, 22 Feb 2006 14:20:08 +0000 Subject: [PATCH] - Deal with missing syslog function by making code conditional on presence of syslog.h header file (DOS/djgpp). (Christophe) - Avoid clash with existing constants (OSX). (Christophe) --- ChangeLog | 3 +++ configure.ac | 2 +- include/ntfs/types.h | 12 ++++++++++++ libntfs/logging.c | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1c2bc75c..855dee5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -115,6 +115,9 @@ - Implement simple syslog logging handler (need more work), teach ntfsmount to use it. (Yura) - Fix a lot of bugs in attribute resizing code. (Yura) + - Deal with missing syslog function by making code conditional on + presence of syslog.h header file (DOS/djgpp). (Christophe) + - Avoid clash with existing constants (OSX). (Christophe) 10/10/2005 - 1.12.1 - Minor fix to location of mount.ntfs-fuse and mkfs.ntfs. diff --git a/configure.ac b/configure.ac index 081b13dc..8c495fe5 100644 --- a/configure.ac +++ b/configure.ac @@ -332,7 +332,7 @@ AC_CHECK_HEADERS([ctype.h fcntl.h libgen.h libintl.h limits.h locale.h \ endian.h byteswap.h sys/byteorder.h sys/endian.h sys/param.h \ sys/ioctl.h sys/mount.h sys/stat.h sys/types.h sys/vfs.h \ sys/statvfs.h sys/sysmacros.h linux/major.h linux/fd.h linux/hdreg.h \ - machine/endian.h gcrypt.h windows.h gnutls/pkcs12.h]) + machine/endian.h gcrypt.h windows.h gnutls/pkcs12.h syslog.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STDBOOL diff --git a/include/ntfs/types.h b/include/ntfs/types.h index 00f83ccc..4987d785 100644 --- a/include/ntfs/types.h +++ b/include/ntfs/types.h @@ -85,12 +85,24 @@ typedef sle64 leLSN; * enum BOOL - These are just to make the code more readable... */ typedef enum { +#ifndef FALSE FALSE = 0, +#endif +#ifndef NO NO = 0, +#endif +#ifndef ZERO ZERO = 0, +#endif +#ifndef TRUE TRUE = 1, +#endif +#ifndef YES YES = 1, +#endif +#ifndef ONE ONE = 1, +#endif } BOOL; #endif /* defined _WINDEF_H */ diff --git a/libntfs/logging.c b/libntfs/logging.c index 4997f7f2..c79128a6 100644 --- a/libntfs/logging.c +++ b/libntfs/logging.c @@ -38,7 +38,9 @@ #ifdef HAVE_STDLIB_H #include #endif +#ifdef HAVE_SYSLOG_H #include +#endif #include "logging.h" @@ -278,8 +280,10 @@ void ntfs_log_set_handler(ntfs_log_handler *handler) { if (handler) { ntfs_log.handler = handler; +#ifdef HAVE_SYSLOG_H if (handler == ntfs_log_handler_syslog) openlog("libntfs", LOG_PID, LOG_USER); +#endif } else ntfs_log.handler = ntfs_log_handler_null; } @@ -337,6 +341,8 @@ int ntfs_log_redirect(const char *function, const char *file, * 0 Message wasn't logged * num Number of output characters */ + +#ifdef HAVE_SYSLOG_H int ntfs_log_handler_syslog(const char *function __attribute__((unused)), const char *file, __attribute__((unused)) int line, u32 level, void *data __attribute__((unused)), const char *format, va_list args) @@ -393,6 +399,7 @@ int ntfs_log_handler_syslog(const char *function __attribute__((unused)), errno = olderr; return ret; } +#endif /** * ntfs_log_handler_fprintf - Basic logging handler