diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2018-05-24 01:13:38 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2018-05-24 01:13:38 +0000 |
commit | 919290b79eb6649d6d05242180ddb3944ca9521b (patch) | |
tree | e2b2f839acafdc5493bb21e81e4361f37c8f4357 /src/sg_verify.c | |
parent | 26e76bf6c671941fec1a8d2b3fb53fcd64993577 (diff) | |
download | sg3_utils-919290b79eb6649d6d05242180ddb3944ca9521b.tar.gz |
add SG_LIB_LOGIC_ERROR and SG_LIB_CONTRADICT; implement across many utilities and increase usage of sg_convert_errno()
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@774 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_verify.c')
-rw-r--r-- | src/sg_verify.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sg_verify.c b/src/sg_verify.c index 34954d65..51e74139 100644 --- a/src/sg_verify.c +++ b/src/sg_verify.c @@ -37,7 +37,7 @@ * the possibility of protection data (DIF). */ -static const char * version_str = "1.23 20180515"; /* sbc4r01 */ +static const char * version_str = "1.24 20180523"; /* sbc4r15 */ #define ME "sg_verify: " @@ -282,7 +282,7 @@ main(int argc, char * argv[]) } else if (bytchk > 0) { pr2serr("when the 'ebytchk=BCH' option is given, then '--bytchk=NDO' " "must also be given\n"); - return SG_LIB_SYNTAX_ERROR; + return SG_LIB_CONTRADICT; } if ((bpc > 0xffff) && (! verify16)) { @@ -315,10 +315,10 @@ main(int argc, char * argv[]) perror("sg_set_binary_mode"); } else { if ((infd = open(file_name, O_RDONLY)) < 0) { + ret = sg_convert_errno(errno); snprintf(ebuff, EBUFF_SZ, ME "could not open %s for reading", file_name); perror(ebuff); - ret = SG_LIB_FILE_ERROR; goto err_out; } else if (sg_set_binary_mode(infd) < 0) perror("sg_set_binary_mode"); @@ -328,9 +328,9 @@ main(int argc, char * argv[]) for (nread = 0; nread < ndo; nread += res) { res = read(infd, ref_data + nread, ndo - nread); if (res <= 0) { + ret = sg_convert_errno(errno); pr2serr("reading from %s failed at file offset=%d\n", (got_stdin ? "stdin" : file_name), nread); - ret = SG_LIB_FILE_ERROR; goto err_out; } } |