[PATCH 2/3] Changed return code from mediaCheckFile when file open fails to -2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is no way to differentiate between a file open failing and
failure to find the embedded MD5, both returned -1. This changes the
return code for failing to open the file to -2.

This also changes the exit code from printMD5SUM to 2 from 1 when the file
fails to be opened.
---
 libcheckisomd5.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcheckisomd5.c b/libcheckisomd5.c
index 3709206..8bdb1a4 100644
--- a/libcheckisomd5.c
+++ b/libcheckisomd5.c
@@ -322,7 +322,7 @@ int mediaCheckFile(char *file, checkCallback cb, void *cbdata) {
     isofd = open(file, O_RDONLY);
 
     if (isofd < 0) {
-	return -1;
+	return -2;
     }
 
     rc = doMediaCheck(isofd, mediasum, computedsum, &isosize, &supported, cb, cbdata);
@@ -348,7 +348,7 @@ void printMD5SUM(char *file) {
 
     if (isofd < 0) {
 	fprintf(stderr, "%s: Unable to find install image.\n", file);
-	exit(1);
+	exit(2);
     }
 
     if (parsepvd(isofd, mediasum, &skipsectors, &isosize, &supported, fragmentsums, &fragmentcount) < 0) {
-- 
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux