> Please feel free to remove the offending 'args = NULL;' lines. It's part 
> of a dead, unused, broken functionality. It will be fixed properly in the
> next ntfs-3g release.

Hi. Attached is the complete ntfs-3g fix. Compile tested only on x86.

   Thanks,
            Szaka
Index: include/ntfs-3g/logging.h
===================================================================
RCS file: /home/szaka/devel/CVS/ntfs-3g/include/ntfs-3g/logging.h,v
retrieving revision 1.2
diff -u -d -p -r1.2 logging.h
--- include/ntfs-3g/logging.h   29 Oct 2006 01:18:57 -0000      1.2
+++ include/ntfs-3g/logging.h   29 Oct 2006 01:57:38 -0000
@@ -75,7 +75,6 @@ int ntfs_log_redirect(const char *functi
 #define NTFS_LOG_LEVEL_ERROR   (1 <<  7) /* Operation failed, no damage done */
 #define NTFS_LOG_LEVEL_PERROR  (1 <<  8) /* Message : standard error 
description */
 #define NTFS_LOG_LEVEL_CRITICAL        (1 <<  9) /* Operation failed,damage 
may have occurred */
-#define NTFS_LOG_LEVEL_REASON  (1 << 10) /* Human readable reason for failure 
*/
 
 /* Logging style flags - Manage the style of the output */
 #define NTFS_LOG_FLAG_PREFIX   (1 << 0) /* Prefix messages with "ERROR: ", etc 
*/
@@ -96,7 +95,6 @@ int ntfs_log_redirect(const char *functi
 #define ntfs_log_quiet(FORMAT, ARGS...) 
ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_QUIET,NULL,FORMAT,##ARGS)
 #define ntfs_log_verbose(FORMAT, ARGS...) 
ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_VERBOSE,NULL,FORMAT,##ARGS)
 #define ntfs_log_warning(FORMAT, ARGS...) 
ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_WARNING,NULL,FORMAT,##ARGS)
-#define ntfs_log_reason(FORMAT, ARGS...) 
ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__,NTFS_LOG_LEVEL_REASON,NULL,FORMAT,##ARGS)
 
 /* By default debug and trace messages are compiled into the program,
  * but not displayed.
cvs diff: Diffing libntfs-3g
Index: libntfs-3g/logging.c
===================================================================
RCS file: /home/szaka/devel/CVS/ntfs-3g/libntfs-3g/logging.c,v
retrieving revision 1.2
diff -u -d -p -r1.2 logging.c
--- libntfs-3g/logging.c        29 Oct 2006 01:18:57 -0000      1.2
+++ libntfs-3g/logging.c        29 Oct 2006 01:57:38 -0000
@@ -80,7 +80,7 @@ static struct ntfs_logging ntfs_log = {
 #endif
        NTFS_LOG_LEVEL_INFO | NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_WARNING |
        NTFS_LOG_LEVEL_ERROR | NTFS_LOG_LEVEL_PERROR | NTFS_LOG_LEVEL_CRITICAL |
-       NTFS_LOG_LEVEL_REASON | NTFS_LOG_LEVEL_PROGRESS,
+       NTFS_LOG_LEVEL_PROGRESS,
        NTFS_LOG_FLAG_ONLYNAME,
 #ifdef DEBUG
        ntfs_log_handler_outerr
@@ -349,26 +349,9 @@ int ntfs_log_handler_syslog(const char *
        const char *file, __attribute__((unused)) int line, u32 level,
        void *data __attribute__((unused)), const char *format, va_list args)
 {
-       const int reason_size = 128;
-       static char *reason = NULL;
        int ret = 0;
        int olderr = errno;
 
-       if (level == NTFS_LOG_LEVEL_REASON) {
-               if (!reason)
-                       reason = ntfs_malloc(reason_size);
-               if (reason) {
-                       memset(reason, 0, reason_size);
-                       return vsnprintf(reason, reason_size, format, args);
-               } else {
-                       /* Rather than call ourselves, just drop through */
-                       level = NTFS_LOG_LEVEL_PERROR;
-                       format = "Couldn't create reason";
-                       args = NULL;
-                       olderr = errno;
-               }
-       }
-
        if ((ntfs_log.flags & NTFS_LOG_FLAG_ONLYNAME) &&
            (strchr(file, PATH_SEP)))           /* Abbreviate the filename */
                file = strrchr(file, PATH_SEP) + 1;
@@ -427,8 +410,6 @@ int ntfs_log_handler_syslog(const char *
 int ntfs_log_handler_fprintf(const char *function, const char *file,
        int line, u32 level, void *data, const char *format, va_list args)
 {
-       const int reason_size = 128;
-       static char *reason = NULL;
        int ret = 0;
        int olderr = errno;
        FILE *stream;
@@ -439,21 +420,6 @@ int ntfs_log_handler_fprintf(const char 
                return 0;       /* If it's NULL, we can't do anything. */
        stream = (FILE*)data;
 
-       if (level == NTFS_LOG_LEVEL_REASON) {
-               if (!reason)
-                       reason = ntfs_malloc(reason_size);
-               if (reason) {
-                       memset(reason, 0, reason_size);
-                       return vsnprintf(reason, reason_size, format, args);
-               } else {
-                       /* Rather than call ourselves, just drop through */
-                       level = NTFS_LOG_LEVEL_PERROR;
-                       format = "Couldn't create reason";
-                       args = NULL;
-                       olderr = errno;
-               }
-       }
-
        if (ntfs_log.flags & NTFS_LOG_FLAG_COLOUR) {
                /* Pick a colour determined by the log level */
                switch (level) {
@@ -503,12 +469,8 @@ int ntfs_log_handler_fprintf(const char 
 
        ret += vfprintf(stream, format, args);
 
-       if (level & NTFS_LOG_LEVEL_PERROR) {
-               if (reason)
-                       ret += fprintf(stream, ": %s\n", reason);
-               else
-                       ret += fprintf(stream, ": %s\n", strerror(olderr));
-       }
+       if (level & NTFS_LOG_LEVEL_PERROR)
+               ret += fprintf(stream, ": %s\n", strerror(olderr));
 
        if (col_suffix)
                ret += fprintf(stream, col_suffix);
cvs diff: Diffing src

Reply via email to