Fix compilation on environments that one can not assign to "va_list args" (e.g. Debian Alpha). Do so by removing the unused log_reason code. Originally, Szaka asked FlatCap for it but never used it. I've asked Szaka if he is going to use it but he did not reply. I got an implicit answer in the form of ntfs-3g commit. Therefore, commit an updated version of the patch I've sent the Debian package maintainer.

edge.strict_endians
uvman 2006-11-01 14:05:09 +00:00
parent 7d585a0327
commit 1598a68d67
2 changed files with 5 additions and 49 deletions

View File

@ -75,7 +75,6 @@ int ntfs_log_redirect(const char *function, const char *file, int line,
#define NTFS_LOG_LEVEL_ERROR ((u32)1 << 7) /* Operation failed, no damage done */
#define NTFS_LOG_LEVEL_PERROR ((u32)1 << 8) /* Message : standard error description */
#define NTFS_LOG_LEVEL_CRITICAL ((u32)1 << 9) /* Operation failed,damage may have occurred */
#define NTFS_LOG_LEVEL_REASON ((u32)1 << 10) /* Human readable reason for failure */
/* Logging style flags - Manage the style of the output */
#define NTFS_LOG_FLAG_PREFIX ((u32)1 << 0) /* Prefix messages with "ERROR: ", etc */
@ -96,7 +95,6 @@ int ntfs_log_redirect(const char *function, const char *file, int line,
#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.

View File

@ -77,7 +77,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
@ -346,26 +346,9 @@ 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)
{
const int reason_size = 128;
static char *reason = NULL;
int ret = 0;
int olderr = errno;
if (level == NTFS_LOG_LEVEL_REASON) {
if (!reason)
reason = 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;
@ -385,12 +368,8 @@ int ntfs_log_handler_syslog(const char *function __attribute__((unused)),
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));
#endif
vsyslog(LOG_NOTICE, format, args);
ret = 1; /* FIXME: caclulate how many bytes had been written. */
@ -424,8 +403,6 @@ int ntfs_log_handler_syslog(const char *function __attribute__((unused)),
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;
@ -436,21 +413,6 @@ int ntfs_log_handler_fprintf(const char *function, const char *file,
return 0; /* If it's NULL, we can't do anything. */
stream = (FILE*)data;
if (level == NTFS_LOG_LEVEL_REASON) {
if (!reason)
reason = 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) {
@ -500,12 +462,8 @@ int ntfs_log_handler_fprintf(const char *function, const char *file,
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);