more user-friendly error message
authorMilos Jakubicek <xjakub@fi.muni.cz>
Wed, 13 May 2009 22:55:41 +0000 (00:55 +0200)
committerWouter Verhelst <w@uter.be>
Fri, 15 May 2009 13:52:11 +0000 (15:52 +0200)
Hi folks,

we recently had a bug filed against the nbd Fedora package claiming
about the clarity of the error message which is printed when the nbd
module is not loaded:

https://bugzilla.redhat.com/show_bug.cgi?id=496751

What about merging a tiny patch I attached?

Regards,
Milos

nbd-client.c

index 4156915..eba063f 100644 (file)
@@ -232,7 +232,7 @@ int main(int argc, char *argv[]) {
        if (strcmp(argv[0], "-d")==0) {
                nbd = open(argv[1], O_RDWR);
                if (nbd < 0)
-                       err("Can not open NBD: %m");
+                       err("Cannot open NBD: %m\nPlease ensure the 'nbd' module is loaded.");
                printf("Disconnecting: que, ");
                if (ioctl(nbd, NBD_CLEAR_QUE)< 0)
                        err("Ioctl failed: %m\n");
@@ -276,7 +276,7 @@ int main(int argc, char *argv[]) {
        nbddev = argv[0];
        nbd = open(nbddev, O_RDWR);
        if (nbd < 0)
-         err("Can not open NBD: %m");
+         err("Cannot open NBD: %m\nPlease ensure the 'nbd' module is loaded.");
        ++argv; --argc; /* skip device */
 
        if (argc>3) goto errmsg;