Brian C. Lane wrote:
This moves error reporting out of printMD5SUM into the call in
checkisomd5.c
---
checkisomd5.c | 16 ++++++++++++++--
libcheckisomd5.c | 18 +++++++-----------
libcheckisomd5.h | 2 +-
3 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/checkisomd5.c b/checkisomd5.c
index c721f86..029a9f1 100644
--- a/checkisomd5.c
+++ b/checkisomd5.c
@@ -95,8 +95,20 @@ int main(int argc, char **argv) {
if (!args || !args[0] || !args[0][0])
usage();
- if (md5only|data.verbose)
- printMD5SUM((char *)args[0]);
+ if (md5only|data.verbose) {
+ rc = printMD5SUM((char *)args[0]);
+
+ if (rc < 0) {
+ if (rc == -1)
+ result = "NA.\nNo checksum information available, unable to verify media.";
It is md5only (no verifying), so I'd leave out "unable to verify media"
part here.
Also a nitpick - is there a reason for only a single "\n" at the
beginning - compared
to other cases.
+ else if (rc == -2)
+ result = "NA.\n\nFile open failed.";
This return value handling should be probably added also to
mediaCheckFile return
value handling few lines below, together with corresponding exit value
setting.
Note that I have fixed setting exit value in
https://www.redhat.com/archives/anaconda-devel-list/2010-March/msg00235.html
from my series of patches (it works only with 2 values 0/1).
+ elseFil
+ result = "NA.\n\nUnknown return code from printMD5SUM()";
+ fprintf(stderr, "\n%s\n", result);
+ exit(abs(rc));
+ }
+ }
if (md5only)
exit(0);
Radek
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list