diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2018-05-11 04:36:52 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2018-05-11 04:36:52 +0000 |
commit | 71e56cc16387a76971a04fda4ff9306ec704daf9 (patch) | |
tree | 2c6e6ee4f1f6efd89a16a865ea5301967c6f34db /src/sg_format.c | |
parent | 5a4b80a31b1caeb62fdab8d732582d898b3da9e0 (diff) | |
download | sg3_utils-71e56cc16387a76971a04fda4ff9306ec704daf9.tar.gz |
sg_lib: enhance exit status values and associated strings
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@771 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_format.c')
-rw-r--r-- | src/sg_format.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/sg_format.c b/src/sg_format.c index f3a1f916..563bc307 100644 --- a/src/sg_format.c +++ b/src/sg_format.c @@ -37,7 +37,7 @@ #include "sg_pr2serr.h" #include "sg_pt.h" -static const char * version_str = "1.45 20180330"; +static const char * version_str = "1.46 20180510"; #define RW_ERROR_RECOVERY_PAGE 1 /* can give alternate with --mode=MP */ @@ -1023,7 +1023,7 @@ main(int argc, char **argv) op->verbose)) < 0) { pr2serr("error opening device file: %s: %s\n", op->device_name, safe_strerror(-fd)); - return SG_LIB_FILE_ERROR; + return sg_convert_errno(-fd); } if (op->format > 2) @@ -1346,7 +1346,12 @@ out: if (res < 0) { pr2serr("close error: %s\n", safe_strerror(-res)); if (0 == ret) - return SG_LIB_FILE_ERROR; + ret = sg_convert_errno(-res); + } + if (0 == op->verbose) { + if (! sg_if_can2stderr("sg_format failed: ", ret)) + pr2serr("Some error occurred, try again with '-v' " + "or '-vv' for more information\n"); } return (ret >= 0) ? ret : SG_LIB_CAT_OTHER; } |