Whamcloud - gitweb
Prevent error messages to stderr caused by libblkid calling libdevmapper
authorTheodore Ts'o <tytso@mit.edu>
Sun, 19 Mar 2006 20:26:26 +0000 (15:26 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 19 Mar 2006 20:26:26 +0000 (15:26 -0500)
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>
lib/blkid/ChangeLog
lib/blkid/devname.c

index e0dac82..d46df09 100644 (file)
@@ -1,3 +1,11 @@
+2006-03-19  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * probe.c (blkid_verify): Fix the bid_time sanity checking logic,
index b2ff40f..4c2c895 100644 (file)
@@ -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);