summaryrefslogtreecommitdiff
path: root/lib/blkid/devname.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2006-03-19 15:26:26 -0500
committerTheodore Ts'o <tytso@mit.edu>2006-03-19 15:26:26 -0500
commitf4f425b20bfec2bfa11a2b1df99b246541b3aff9 (patch)
tree41805259fa94e291401698a0c99d26fb2127cece /lib/blkid/devname.c
parent8deb80a5d1078cbe43eaffcdeebf0a1a549d6a54 (diff)
downloade2fsprogs-f4f425b20bfec2bfa11a2b1df99b246541b3aff9.tar.gz
Prevent error messages to stderr caused by libblkid calling libdevmapper
Make the libdevmapper fail quietly if blkid is called without root privileges or the kernel does not include device mapper support. (What is the device mapper _library_ doing writing to stderr, anyway?) Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib/blkid/devname.c')
-rw-r--r--lib/blkid/devname.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c
index b2ff40f0..4c2c895b 100644
--- a/lib/blkid/devname.c
+++ b/lib/blkid/devname.c
@@ -154,6 +154,12 @@ set_pri:
}
#ifdef HAVE_DEVMAPPER
+static void dm_quiet_log(int level, const char *file, int line,
+ const char *f, ...)
+{
+ return;
+}
+
/*
* device-mapper support
*/
@@ -203,9 +209,11 @@ static int dm_device_is_leaf(const dev_t dev)
unsigned int next = 0;
int n, ret = 1;
+ dm_log_init(dm_quiet_log);
task = dm_task_create(DM_DEVICE_LIST);
if (!task)
return 1;
+ dm_log_init(0);
dm_task_run(task);
names = dm_task_get_names(task);
@@ -262,9 +270,11 @@ static void dm_probe_all(blkid_cache cache, int only_if_new)
unsigned int next = 0;
int n;
+ dm_log_init(dm_quiet_log);
task = dm_task_create(DM_DEVICE_LIST);
if (!task)
return;
+ dm_log_init(0);
dm_task_run(task);
names = dm_task_get_names(task);