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 --- pyanaconda/isys/imount.c | 43 ++++++++++--------------------------------- pyanaconda/isys/imount.h | 13 +++---------- 2 files changed, 13 insertions(+), 43 deletions(-) diff --git a/pyanaconda/isys/imount.c b/pyanaconda/isys/imount.c index ed0f5a7..1b832c0 100644 --- a/pyanaconda/isys/imount.c +++ b/pyanaconda/isys/imount.c @@ -224,27 +224,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; } @@ -289,20 +270,16 @@ int mkdirChain(char * origChain) { return 0; } -/* 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.) */ +/* Returns true iff it is possible that a failed mount command 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; } static int mkdirIfNone(char * directory) { diff --git a/pyanaconda/isys/imount.h b/pyanaconda/isys/imount.h index d1b7cf3..e04d3a7 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() */ -- 1.7.2.3 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list