Brian C. Lane wrote:
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;
We are not handling -2 return value when calling the function in anaconda
- though it is not likely the case should happen there, I think we
should handle it.
}
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);
Man page should be updated - and it probably implies changing of return
value when we are also verifying the sum to be consistent (see comment
in 3/3).
Radek
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list