Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions libntfs-3g/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,24 @@ int ntfs_log_handler_syslog(const char *function __attribute__((unused)),
if ((level & NTFS_LOG_LEVEL_PERROR) && errno == ENOSPC)
return 1;
#endif
int priority;
if ( level <= NTFS_LOG_LEVEL_DEBUG ) {
priority = LOG_DEBUG;
} else if ( level <= NTFS_LOG_LEVEL_INFO ) {
priority = LOG_INFO;
} else if ( level <= NTFS_LOG_LEVEL_WARNING ) {
priority = LOG_NOTICE;
} else if ( level <= NTFS_LOG_LEVEL_ERROR ) {
priority = LOG_ERR;
} else if ( level <= NTFS_LOG_LEVEL_CRITICAL ) {
priority = LOG_CRIT;
} else {
priority = LOG_ALERT;
}

ret = vsnprintf(logbuf, LOG_LINE_LEN, format, args);
if (ret < 0) {
vsyslog(LOG_NOTICE, format, args);
vsyslog(priority, format, args);
ret = 1;
goto out;
}
Expand All @@ -382,7 +397,7 @@ int ntfs_log_handler_syslog(const char *function __attribute__((unused)),
ret = strlen(logbuf);
}

syslog(LOG_NOTICE, "%s", logbuf);
syslog(priority, "%s", logbuf);
out:
errno = olderr;
return ret;
Expand Down