On mount failing, it would be nice to have a similar facility. We
already return IMOUNT_ERR_OTHER there, but we have no information about
what the problem really is. There's the status code right there, but
that's not at all exposed outside the function and I really don't want
to introduce some sort of crazy isys errno.
- Chris
Below is what I'm thinking about. Simple and extensible. I might as well
add all the mount error codes right now if we want that.
Ales
diff --git a/isys/imount.c b/isys/imount.c
index a62e223..e23de12 100644
--- a/isys/imount.c
+++ b/isys/imount.c
@@ -189,8 +189,18 @@ int mountCommandWrapper(int mode, char *dev, char
*where, char *fs,
free(device);
}
- if (!WIFEXITED(status) || (WIFEXITED(status) && WEXITSTATUS(status)))
- return IMOUNT_ERR_OTHER;
+ if (!WIFEXITED(status))
+ return IMOUNT_ERR_OTHER;
+ else if (rc = WEXITSTATUS(status)) {
+ /* see 'man mount' for the mount error codes
+ * currently we care only for some of them. */
+ switch (rc) {
+ case 32:
+ return IMOUNT_ERR_MOUNTFAILURE;
+ default:
+ return IMOUNT_ERR_OTHER;
+ }
+ }
return 0;
}
diff --git a/isys/imount.h b/isys/imount.h
index 95cca38..063d9b6 100644
--- a/isys/imount.h
+++ b/isys/imount.h
@@ -20,9 +20,10 @@
#ifndef H_IMOUNT
#define H_IMOUNT
-#define IMOUNT_ERR_ERRNO 1
-#define IMOUNT_ERR_OTHER 2
-#define IMOUNT_ERR_MODE 3
+#define IMOUNT_ERR_ERRNO 1
+#define IMOUNT_ERR_OTHER 2
+#define IMOUNT_ERR_MODE 3
+#define IMOUNT_ERR_MOUNTFAILURE 4
#include <sys/mount.h> /* for umount() */
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list