[linux-lvm] [PATCH] user check in lvmiopversion

Claudio Matsuoka claudio at conectiva.com
Fri Dec 22 23:21:40 UTC 2000


Quite trivial, but avoids misleading error messages like

  [claudio at pokey:/home/claudio] vgscan
  lvmiopversion -- LVM driver/module not loaded?

  vgscan: /lib/lvm-iop not found.  Is lvm-iop installed?

when running a wrapped tool. Also a test for the return value != 0 is
needed in the wrapper script:

IOP=`/sbin/lvmiopversion`
ret=$?
if [ $ret -ne 0 ]; then
    exit $ret
fi

---8<-----

--- lvmiopversion.c-orig	Fri Dec 22 18:06:14 2000
+++ lvmiopversion.c	Fri Dec 22 18:05:57 2000
@@ -19,6 +19,12 @@
  * Boston, MA 02111-1307, USA.
  */

+/*
+ * Changelog
+ *
+ *    22/12/2000 - added SUSER_CHECK to avoid complaints about module
+ *                 not loaded. --claudio
+ */
 #include <stdio.h>
 #include <lvm_user.h>

@@ -31,6 +37,8 @@
 int main(int argc, char *argv[])
 {
 	int ver = lvm_get_iop_version();
+
+	SUSER_CHECK;

 	if (ver < 0) {
 		fprintf(stderr, "%s -- LVM driver/module not loaded?\n\n", cmd);




More information about the linux-lvm mailing list