From: Theodore Ts'o Date: Sun, 19 Mar 2006 20:26:26 +0000 (-0500) Subject: Prevent error messages to stderr caused by libblkid calling libdevmapper X-Git-Tag: E2FSPROGS-1.39-WIP-0330~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f4f425b20bfec2bfa11a2b1df99b246541b3aff9;p=thirdparty%2Fe2fsprogs.git 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" --- diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog index e0dac822b..d46df0984 100644 --- a/lib/blkid/ChangeLog +++ b/lib/blkid/ChangeLog @@ -1,3 +1,11 @@ +2006-03-19 Theodore Ts'o + + * devname.c (dm_probe_all, dm_device_is_leaf): 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?) + 2006-03-12 Theodore Ts'o * probe.c (blkid_verify): Fix the bid_time sanity checking logic, diff --git a/lib/blkid/devname.c b/lib/blkid/devname.c index b2ff40f02..4c2c895b2 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);