summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2010-11-08 14:48:12 -0600
committerDavid Lehman <dlehman@redhat.com>2010-11-10 16:07:00 -0600
commit9d8e4cb2cecf5bfeed1d9e6d032be75da0a4ba67 (patch)
treec51276141f084ec6baf92619d29a8c4ab4df5c3a
parentd7a52885f2e7ef13df67f63650855f76b460eb14 (diff)
downloadanaconda-9d8e4cb2cecf5bfeed1d9e6d032be75da0a4ba67.tar.gz
anaconda-9d8e4cb2cecf5bfeed1d9e6d032be75da0a4ba67.tar.xz
anaconda-9d8e4cb2cecf5bfeed1d9e6d032be75da0a4ba67.zip
Return mount's actual error codes instead of obfuscating them.
In addition to being unnecessary, this obfuscation does not account for the fact that the codes can be combined using a bitwise or. This is part of the reason we were unable to identify the actual problem with the series of bugs involving the error "SystemError: (2, None)" during F11, F12, and perhaps after that. Related: rhbz#548592
-rw-r--r--pyanaconda/isys/imount.c39
-rw-r--r--pyanaconda/isys/imount.h13
2 files changed, 10 insertions, 42 deletions
diff --git a/pyanaconda/isys/imount.c b/pyanaconda/isys/imount.c
index 39265a082..273d9e1e0 100644
--- a/pyanaconda/isys/imount.c
+++ b/pyanaconda/isys/imount.c
@@ -223,27 +223,8 @@ int mountCommandWrapper(int mode, char *dev, char *where, char *fs,
if (!WIFEXITED(status))
return IMOUNT_ERR_OTHER;
- else if ( (rc = WEXITSTATUS(status)) ) {
- /* Refer to 'man mount' for the meaning of the error codes. */
- switch (rc) {
- case 1:
- return IMOUNT_ERR_PERMISSIONS;
- case 2:
- return IMOUNT_ERR_SYSTEM;
- case 4:
- return IMOUNT_ERR_MOUNTINTERNAL;
- case 8:
- return IMOUNT_ERR_USERINTERRUPT;
- case 16:
- return IMOUNT_ERR_MTAB;
- case 32:
- return IMOUNT_ERR_MOUNTFAILURE;
- case 64:
- return IMOUNT_ERR_PARTIALSUCC;
- default:
- return IMOUNT_ERR_OTHER;
- }
- }
+ else if ( (rc = WEXITSTATUS(status)) )
+ return rc;
return 0;
}
@@ -265,16 +246,10 @@ int doPwUmount(char *where, char **err) {
/* Returns true iff it is possible that the mount command that have returned
* 'errno' might succeed at a later time (think e.g. not yet initialized USB
- * device, etc.) */
-int mountMightSucceedLater(int mountRc)
{
- int rc;
- switch (mountRc) {
- case IMOUNT_ERR_MOUNTFAILURE:
- rc = 1;
- break;
- default:
- rc = 0;
- }
- return rc;
+ /* 32 is the mount exit code for "mount failure" */
+ if (mountRc > 0 && mountRc & 0x20)
+ return 1;
+ else
+ return 0;
}
diff --git a/pyanaconda/isys/imount.h b/pyanaconda/isys/imount.h
index 3ce638771..0af238d91 100644
--- a/pyanaconda/isys/imount.h
+++ b/pyanaconda/isys/imount.h
@@ -20,16 +20,9 @@
#ifndef H_IMOUNT
#define H_IMOUNT
-#define IMOUNT_ERR_ERRNO 1
-#define IMOUNT_ERR_OTHER 2
-#define IMOUNT_ERR_MODE 3
-#define IMOUNT_ERR_PERMISSIONS 4
-#define IMOUNT_ERR_SYSTEM 5
-#define IMOUNT_ERR_MOUNTINTERNAL 6
-#define IMOUNT_ERR_USERINTERRUPT 7
-#define IMOUNT_ERR_MTAB 8
-#define IMOUNT_ERR_MOUNTFAILURE 9
-#define IMOUNT_ERR_PARTIALSUCC 10
+#define IMOUNT_ERR_ERRNO -1
+#define IMOUNT_ERR_OTHER -2
+#define IMOUNT_ERR_MODE -3
#include <sys/mount.h> /* for umount() */