diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index c133c28a6..4afe32705 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,6 +1,7 @@ Version 1.02.21 - ================================ Fix dmsetup -o devno string termination. (1.02.20) + Print warnings to stderr instead of stdout. Version 1.02.20 - 15th June 2007 ================================ diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c index 22eab24bf..734ff9fb8 100644 --- a/libdm/ioctl/libdm-iface.c +++ b/libdm/ioctl/libdm-iface.c @@ -592,9 +592,9 @@ static int _dm_names_v1(struct dm_ioctl_v1 *dmi) struct stat buf; char path[PATH_MAX]; - log_print("Warning: Device list may be incomplete with interface " + log_warn("WARNING: Device list may be incomplete with interface " "version 1."); - log_print("Please upgrade your kernel device-mapper driver."); + log_warn("Please upgrade your kernel device-mapper driver."); if (!(d = opendir(dev_dir))) { log_error("%s: opendir failed: %s", dev_dir, strerror(errno)); @@ -693,7 +693,7 @@ static int _dm_task_run_v1(struct dm_task *dmt) if (dmi->flags & DM_BUFFER_FULL_FLAG) /* FIXME Increase buffer size and retry operation (if query) */ - log_error("Warning: libdevmapper buffer too small for data"); + log_error("WARNING: libdevmapper buffer too small for data"); switch (dmt->type) { case DM_DEVICE_CREATE: @@ -1650,7 +1650,7 @@ repeat_ioctl: dm_free(dmi); goto repeat_ioctl; default: - log_error("Warning: libdevmapper buffer too small for data"); + log_error("WARNING: libdevmapper buffer too small for data"); } } diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 4aa533b39..9af72562a 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -42,6 +42,9 @@ static void _default_log(int level, const char *file __attribute((unused)), int line __attribute((unused)), const char *f, ...) { va_list ap; + int use_stderr = level & _LOG_STDERR; + + level &= ~_LOG_STDERR; if (level > _LOG_WARN && !_verbose) return; @@ -51,14 +54,14 @@ static void _default_log(int level, const char *file __attribute((unused)), if (level < _LOG_WARN) vfprintf(stderr, f, ap); else - vprintf(f, ap); + vfprintf(use_stderr ? stderr : stdout, f, ap); va_end(ap); if (level < _LOG_WARN) fprintf(stderr, "\n"); else - fprintf(stdout, "\n"); + fprintf(use_stderr ? stderr : stdout, "\n"); } dm_log_fn dm_log = _default_log;