1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Make warnings go to stderr. Adds log_warn macro for that purpose,

log_print continues to print to stdout.
This commit is contained in:
Petr Rockai 2007-06-28 17:27:02 +00:00
parent 933b1e9b8f
commit ba117ad80e
3 changed files with 10 additions and 6 deletions

View File

@ -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
================================

View File

@ -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");
}
}

View File

@ -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;