aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--debian/changelog2
-rw-r--r--include/sg_lib_data.h8
-rw-r--r--lib/sg_lib.c59
-rw-r--r--lib/sg_lib_data.c80
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/sg_bg_ctl.c31
-rw-r--r--src/sg_compare_and_write.c11
-rw-r--r--src/sg_copy_results.c9
-rw-r--r--src/sg_format.c11
-rw-r--r--src/sg_get_config.c13
-rw-r--r--src/sg_get_lba_status.c11
-rw-r--r--src/sg_ident.c11
-rw-r--r--src/sg_logs.c7
-rw-r--r--src/sg_luns.c9
15 files changed, 174 insertions, 95 deletions
diff --git a/ChangeLog b/ChangeLog
index 711170e3..166bee95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for sg3_utils-1.43 [20180506] [svn: r770]
+Changelog for sg3_utils-1.43 [20180510] [svn: r771]
- sg_write_x: where x can be normal, atomic, or(write),
same, scattered, or stream writes with 16 or 32 byte
cdbs (sbc4r04 for atomic, sbc4r11 for scattered)
@@ -123,7 +123,8 @@ Changelog for sg3_utils-1.43 [20180506] [svn: r770]
code in several utilities limited it to 31, fix
- convert many two valued 'int's to bool
- sg_lib: add SSC maintenance in/out sa names
- - enhance exit status, add SG_LIB_OS_BASE_ERR (50)
+ - enhance exit status values and associated
+ strings, add SG_LIB_OS_BASE_ERR (50)
- add sg_ll_inquiry_v2() and sg_ll_inquiry_pt()
- add sg_ll_log_sense_v2()
- add sg_ll_mode_sense10_v2()
diff --git a/debian/changelog b/debian/changelog
index 0518c943..26cd66e7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.43-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Tue, 01 May 2018 13:00:00 -0400
+ -- Douglas Gilbert <dgilbert@interlog.com> Thu, 10 May 2018 23:00:00 -0400
sg3-utils (1.42-0.1) unstable; urgency=low
diff --git a/include/sg_lib_data.h b/include/sg_lib_data.h
index cff13ed9..a8700439 100644
--- a/include/sg_lib_data.h
+++ b/include/sg_lib_data.h
@@ -59,6 +59,12 @@ struct sg_lib_value_name_t {
const char * name;
};
+struct sg_value_2names_t {
+ int value;
+ const char * name;
+ const char * name2;
+};
+
struct sg_lib_asc_ascq_t {
uint8_t asc; /* additional sense code */
uint8_t ascq; /* additional sense code qualifier */
@@ -116,6 +122,8 @@ extern struct sg_lib_simple_value_name_t sg_lib_nvme_nvm_cmd_arr[];
extern struct sg_lib_value_name_t sg_lib_nvme_cmd_status_arr[];
extern struct sg_lib_4tuple_u8 sg_lib_scsi_status_sense_arr[];
+extern struct sg_value_2names_t sg_exit_str_arr[];
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/sg_lib.c b/lib/sg_lib.c
index 810d6e30..ee1c8242 100644
--- a/lib/sg_lib.c
+++ b/lib/sg_lib.c
@@ -1841,63 +1841,6 @@ sg_print_sense(const char * leadin, const uint8_t * sbp, int sb_len,
free(free_cp);
}
-struct value_2names_t {
- int value;
- const char * name;
- const char * name2;
-};
-
-/* These are the error (or warning) exit status values and their associated
- * strings. They combine utility input syntax errors, SCSI status and sense
- * key categories, OS errors (e.g. ENODEV for device not found), one that
- * indicates NVMe non-zero status plus listing those that a Unix OS generates
- * for any executable (that fails). The convention is 0 means no error and
- * that in Unix the exit status is an (unsigned) 8 bit value. */
-static struct value_2names_t exit_str_arr[] = {
- {0, "No errors", NULL},
- {1, "Syntax error", NULL},
- {2, "Device not ready", "sense key"},
- {3, "Medium or hardware error", "sense key (plus blank check for tape)"},
- {5, "Illegal request", "sense key, apart from Invalid opcode"},
- {6, "Unit attention", "sense key"},
- {7, "Data protect", "sense key, write protected media?"},
- {9, "Illegal request, Invalid opcode", "sense key + asc,ascq"},
- {10, "Copy aborted", "sense key"},
- {11, "Aborted command",
- "sense key, other than protection related (asc=0x10)"},
- {14, "Miscompare", "sense key"},
- {15, "File error", NULL},
- {17, "Illegal request with Info field", NULL},
- {18, "Medium or hardware error with Info", NULL},
- {20, "No sense key", "probably additional sense code"},
- {21, "Recovered error (warning)", "sense key"}, /* Warning not error */
- {22, "LBA out of range", NULL},
- {24, "Reservation conflict", "SCSI status"},
- {25, "Condition met", "SCSI status"}, /* from PRE-FETCH command */
- {26, "Busy", "SCSI status"}, /* more likely if SAS expander present */
- {27, "Task set full", "SCSI status"},
- {28, "ACA aactive", "SCSI status"},
- {29, "Task aborted", "SCSI status"},
- {33, "SCSI command timeout", NULL}, /* OS timed out command */
- {40, "Aborted command, protection error", NULL},
- {41, "Aborted command, protection error with Info field", NULL},
- {48, "NVMe command with non-zero status", NULL},
- {50, "An OS error occurred", "(errno > 46)"},
- /* OS errors (errno in Unix) from 1 to 46 mapped into this range */
- {97, "Malformed SCSI command", "trouble building command"},
- {98, "Some other sense error", "try '-v' option for more information"},
- {99, "Some other error", "possible transport of driver issue"},
- /* 100 through 125 unused */
-
- /* The following error codes are generated by a Unix OS */
- /* 126: utility did not have executable permissions */
- /* 127: utility to be executed not found */
- /* 128 + <signal_number>: signal number that aborted the utility.
- real time signals start at offset SIGRTMIN */
- /* 255: utility returned an exit status > 255 (and probably < 0) */
- {0xffff, NULL, NULL}, /* end marking sentinel */
-};
-
/* This examines exit_status and if an error message is known it is output
* as a string to 'b' and true is returned. If 'longer' is true and extra
* information is available then it is added to the output. If no error
@@ -1910,7 +1853,7 @@ static struct value_2names_t exit_str_arr[] = {
* string including the trailing null character is no longer than b_len. */
bool sg_exit2str(int exit_status, bool longer, int b_len, char *b)
{
- const struct value_2names_t * ess = exit_str_arr;
+ const struct sg_value_2names_t * ess = sg_exit_str_arr;
if ((b_len < 1) || (NULL == b))
return false;
diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c
index 1700d0f7..1524979e 100644
--- a/lib/sg_lib_data.c
+++ b/lib/sg_lib_data.c
@@ -17,7 +17,7 @@
#include "sg_lib_data.h"
-const char * sg_lib_version_str = "2.43 20180504";/* spc5r19, sbc4r15 */
+const char * sg_lib_version_str = "2.44 20180510";/* spc5r19, sbc4r15 */
/* indexed by pdt; those that map to own index do not decay */
@@ -1480,7 +1480,7 @@ const char * sg_lib_pdt_strs[32] = { /* should have 2**5 elements */
"object based storage",
"automation/driver interface",
"security manager device", /* obsolete, spc5r01 */
- "zoned block commands",
+ "host managed zoned block",
"0x15", "0x16", "0x17", "0x18",
"0x19", "0x1a", "0x1b", "0x1c", "0x1d",
"well known logical unit",
@@ -1734,6 +1734,78 @@ struct sg_lib_4tuple_u8 sg_lib_scsi_status_sense_arr[] =
{0xff, 0xff, 0xff, 0xff},
};
+/* These are the error (or warning) exit status values and their associated
+ * strings. They combine utility input syntax errors, SCSI status and sense
+ * key categories, OS errors (e.g. ENODEV for device not found), one that
+ * indicates NVMe non-zero status plus listing those that a Unix OS generates
+ * for any executable (that fails). The convention is 0 means no error and
+ * that in Unix the exit status is an (unsigned) 8 bit value. */
+struct sg_value_2names_t sg_exit_str_arr[] = {
+ {0, "No errors", NULL},
+ {1, "Syntax error", NULL},
+ {2, "Device not ready", "sense key"},
+ {3, "Medium or hardware error", "sense key (plus blank check for tape)"},
+ {5, "Illegal request", "sense key, apart from Invalid opcode"},
+ {6, "Unit attention", "sense key"},
+ {7, "Data protect", "sense key, write protected media?"},
+ {9, "Illegal request, Invalid opcode", "sense key + asc,ascq"},
+ {10, "Copy aborted", "sense key"},
+ {11, "Aborted command",
+ "sense key, other than protection related (asc=0x10)"},
+ {14, "Miscompare", "sense key"},
+ {15, "File error", NULL},
+ {17, "Illegal request with Info field", NULL},
+ {18, "Medium or hardware error with Info", NULL},
+ {20, "No sense key", "probably additional sense code"},
+ {21, "Recovered error (warning)", "sense key"}, /* Warning not error */
+ {22, "LBA out of range", NULL},
+ {24, "Reservation conflict", "SCSI status"},
+ {25, "Condition met", "SCSI status"}, /* from PRE-FETCH command */
+ {26, "Busy", "SCSI status"}, /* more likely if SAS expander present */
+ {27, "Task set full", "SCSI status"},
+ {28, "ACA aactive", "SCSI status"},
+ {29, "Task aborted", "SCSI status"},
+ {33, "SCSI command timeout", NULL}, /* OS timed out command */
+ {40, "Aborted command, protection error", NULL},
+ {41, "Aborted command, protection error with Info field", NULL},
+ {48, "NVMe command with non-zero status", NULL},
+ {50, "An OS error occurred", "(errno > 46)"},
+ /* OS errors (errno in Unix) from 1 to 46 mapped into this range */
+ {97, "Malformed SCSI command", "trouble building command"},
+ {98, "Some other sense error", "try '-v' option for more information"},
+ {99, "Some other error", "possible transport of driver issue"},
+ {100, "Parameter list length error", NULL}, /* these for ddpt, xcopy */
+ {101, "Invalid field in parameter", NULL},
+ {102, "Too many segments in parameters", NULL},
+ {103, "Target underrun", NULL},
+ {104, "Target overrun", NULL},
+ {105, "Operation in progress", NULL},
+ {106, "Insufficient resources to create ROD", NULL},
+ {107, "Insufficient resources to create ROD token", NULL},
+ {108, "Commands cleared by device server", NULL},
+ {109, "See leave_reason for error", NULL}, /* internal error */
+ /* DDPT_CAT_TOKOP_BASE: asc=0x23, ascq=110 follow */
+ {110, "Invalid token operation, cause not reportable", NULL},
+ {111, "Invalid token operation, unsupported token type", NULL},
+ {112, "Invalid token operation, remote token usage not supported", NULL},
+ {113, "Invalid token operation, remote token creation not supported",
+ NULL},
+ {114, "Invalid token operation, token unknown", NULL},
+ {115, "Invalid token operation, token corrupt", NULL},
+ {116, "Invalid token operation, token revoked", NULL},
+ {117, "Invalid token operation, token expired", NULL},
+ {118, "Invalid token operation, token cancelled", NULL},
+ {119, "Invalid token operation, token deleted", NULL},
+ {120, "Invalid token operation, invalid token length", NULL},
+
+ /* The following error codes are generated by a Unix OS */
+ /* 126: utility did not have executable permissions */
+ /* 127: utility to be executed not found */
+ /* 128 + <signal_number>: signal number that aborted the utility.
+ real time signals start at offset SIGRTMIN */
+ /* 255: utility returned an exit status > 255 (and probably < 0) */
+ {0xffff, NULL, NULL}, /* end marking sentinel */
+};
#else /* (SG_SCSI_STRINGS && HAVE_NVME && (! IGNORE_NVME)) */
@@ -1765,4 +1837,8 @@ struct sg_lib_4tuple_u8 sg_lib_scsi_status_sense_arr[] =
{0xff, 0xff, 0xff, 0xff},
};
+struct sg_value_2names_t sg_exit_str_arr[] = {
+ {0xffff, NULL, NULL}, /* end marking sentinel */
+};
+
#endif /* (SG_SCSI_STRINGS && HAVE_NVME && (! IGNORE_NVME)) */
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 32ba4170..05f3fbba 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,7 +79,7 @@ fi
%{_libdir}/*.la
%changelog
-* Tue May 01 2018 - dgilbert at interlog dot com
+* Thu May 10 2018 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.43
diff --git a/src/sg_bg_ctl.c b/src/sg_bg_ctl.c
index 436a8180..b36ef03e 100644
--- a/src/sg_bg_ctl.c
+++ b/src/sg_bg_ctl.c
@@ -33,7 +33,7 @@
* device. Based on sbc4r10.pdf .
*/
-static const char * version_str = "1.06 20180219";
+static const char * version_str = "1.07 20180509";
#define BACKGROUND_CONTROL_SA 0x15
@@ -137,7 +137,8 @@ sg_ll_background_control(int sg_fd, unsigned int bo_ctl, unsigned int bo_time,
int
main(int argc, char * argv[])
{
- int sg_fd, res, c;
+ int sg_fd = -1;
+ int res, c;
unsigned int ctl = 0;
unsigned int time_tnth = 0;
int verbose = 0;
@@ -203,9 +204,11 @@ main(int argc, char * argv[])
sg_fd = sg_cmds_open_device(device_name, false, verbose);
if (sg_fd < 0) {
- pr2serr("open error: %s: %s\n", device_name,
- safe_strerror(-sg_fd));
- return SG_LIB_FILE_ERROR;
+ if (verbose)
+ pr2serr("open error: %s: %s\n", device_name,
+ safe_strerror(-sg_fd));
+ ret = sg_convert_errno(-sg_fd);
+ goto fini;
}
res = sg_ll_background_control(sg_fd, ctl, time_tnth, true, verbose);
@@ -221,11 +224,19 @@ main(int argc, char * argv[])
}
}
- res = sg_cmds_close_device(sg_fd);
- if (res < 0) {
- pr2serr("close error: %s\n", safe_strerror(-res));
- if (0 == ret)
- return SG_LIB_FILE_ERROR;
+fini:
+ if (0 == verbose) {
+ if (! sg_if_can2stderr("sg_bg_ctl failed: ", ret))
+ pr2serr("Some error occurred, try again with '-v' or '-vv' for "
+ "more information\n");
+ }
+ if (sg_fd >= 0) {
+ res = sg_cmds_close_device(sg_fd);
+ if (res < 0) {
+ pr2serr("close error: %s\n", safe_strerror(-res));
+ if (0 == ret)
+ return sg_convert_errno(-res);
+ }
}
return (ret >= 0) ? ret : SG_LIB_CAT_OTHER;
}
diff --git a/src/sg_compare_and_write.c b/src/sg_compare_and_write.c
index e4dbc5ae..24a66b5d 100644
--- a/src/sg_compare_and_write.c
+++ b/src/sg_compare_and_write.c
@@ -54,7 +54,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.22 20180428";
+static const char * version_str = "1.23 20180510";
#define DEF_BLOCK_SIZE 512
#define DEF_NUM_BLOCKS (1)
@@ -72,6 +72,7 @@ static struct option long_options[] = {
{"dpo", no_argument, 0, 'd'},
{"fua", no_argument, 0, 'f'},
{"fua_nv", no_argument, 0, 'F'},
+ {"fua-nv", no_argument, 0, 'F'},
{"group", required_argument, 0, 'g'},
{"grpnum", required_argument, 0, 'g'},
{"help", no_argument, 0, 'h'},
@@ -446,9 +447,8 @@ open_dev(const char * outf, int verbose)
if (sg_fd < 0) {
pr2serr(ME "open error: %s: %s\n", outf,
safe_strerror(-sg_fd));
- return -SG_LIB_FILE_ERROR;
+ return -sg_convert_errno(-sg_fd);
}
-
return sg_fd;
}
@@ -576,5 +576,10 @@ out:
close(wfd);
if (devfd >= 0)
close(devfd);
+ if (0 == op->verbose) {
+ if (! sg_if_can2stderr("sg_compare_and_write failed: ", res))
+ pr2serr("Some error occurred, try again with '-v' "
+ "or '-vv' for more information\n");
+ }
return res;
}
diff --git a/src/sg_copy_results.c b/src/sg_copy_results.c
index 514a33b9..0c64cf61 100644
--- a/src/sg_copy_results.c
+++ b/src/sg_copy_results.c
@@ -38,7 +38,7 @@
and the optional list identifier passed as the list_id argument.
*/
-static const char * version_str = "1.20 20180428";
+static const char * version_str = "1.21 20180510";
#define MAX_XFER_LEN 10000
@@ -461,7 +461,12 @@ finish:
if (res < 0) {
pr2serr(ME "close error: %s\n", safe_strerror(-res));
if (0 == ret)
- return SG_LIB_FILE_ERROR;
+ ret = sg_convert_errno(-res);
+ }
+ if (0 == verbose) {
+ if (! sg_if_can2stderr("sg_copy_results failed: ", ret))
+ pr2serr("Some error occurred, try again with '-v' or '-vv' for "
+ "more information\n");
}
return (ret >= 0) ? ret : SG_LIB_CAT_OTHER;
}
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;
}
diff --git a/src/sg_get_config.c b/src/sg_get_config.c
index 9c49fdd7..3c5db7d1 100644
--- a/src/sg_get_config.c
+++ b/src/sg_get_config.c
@@ -31,7 +31,7 @@
*/
-static const char * version_str = "0.47 20180329"; /* mmc6r02 */
+static const char * version_str = "0.48 20180510"; /* mmc6r02 */
#define MX_ALLOC_LEN 8192
#define NAME_BUFF_SZ 64
@@ -1050,7 +1050,7 @@ main(int argc, char * argv[])
< 0) {
pr2serr(ME "error opening file: %s (ro): %s\n", device_name,
safe_strerror(-sg_fd));
- return SG_LIB_FILE_ERROR;
+ return sg_convert_errno(-sg_fd);
}
if (0 == sg_simple_inquiry(sg_fd, &inq_resp, true, verbose)) {
if (! do_raw)
@@ -1073,7 +1073,7 @@ main(int argc, char * argv[])
sg_fd = sg_cmds_open_device(device_name, readonly, verbose);
if (sg_fd < 0) {
pr2serr(ME "open error (rw): %s\n", safe_strerror(-sg_fd));
- return SG_LIB_FILE_ERROR;
+ return sg_convert_errno(-sg_fd);
}
if (do_raw) {
if (sg_set_binary_mode(STDOUT_FILENO) < 0) {
@@ -1109,7 +1109,12 @@ main(int argc, char * argv[])
if (res < 0) {
pr2serr("close error: %s\n", safe_strerror(-res));
if (0 == ret)
- return SG_LIB_FILE_ERROR;
+ ret = sg_convert_errno(-ret);
+ }
+ if (0 == verbose) {
+ if (! sg_if_can2stderr("sg_get_config failed: ", ret))
+ pr2serr("Some error occurred, try again with '-v' or '-vv' for "
+ "more information\n");
}
return (ret >= 0) ? ret : SG_LIB_CAT_OTHER;
}
diff --git a/src/sg_get_lba_status.c b/src/sg_get_lba_status.c
index 7db694e4..0c48f886 100644
--- a/src/sg_get_lba_status.c
+++ b/src/sg_get_lba_status.c
@@ -32,7 +32,7 @@
* device.
*/
-static const char * version_str = "1.15 20180425";
+static const char * version_str = "1.16 20180510";
#ifndef UINT32_MAX
#define UINT32_MAX ((uint32_t)-1)
@@ -303,7 +303,7 @@ main(int argc, char * argv[])
sg_fd = sg_cmds_open_device(device_name, o_readonly, verbose);
if (sg_fd < 0) {
pr2serr("open error: %s: %s\n", device_name, safe_strerror(-sg_fd));
- ret = SG_LIB_FILE_ERROR;
+ ret = sg_convert_errno(-sg_fd);
goto free_buff;
}
@@ -476,10 +476,15 @@ the_end:
if (res < 0) {
pr2serr("close error: %s\n", safe_strerror(-res));
if (0 == ret)
- ret = SG_LIB_FILE_ERROR;
+ ret = sg_convert_errno(-res);
}
free_buff:
if (free_glbasBuffp)
free(free_glbasBuffp);
+ if (0 == verbose) {
+ if (! sg_if_can2stderr("sg_get_lba_status failed: ", ret))
+ pr2serr("Some error occurred, try again with '-v' or '-vv' for "
+ "more information\n");
+ }
return (ret >= 0) ? ret : SG_LIB_CAT_OTHER;
}
diff --git a/src/sg_ident.c b/src/sg_ident.c
index 5c4830e8..84f924da 100644
--- a/src/sg_ident.c
+++ b/src/sg_ident.c
@@ -31,7 +31,7 @@
* DEVICE IDENTIFIER and SET DEVICE IDENTIFIER prior to spc4r07.
*/
-static const char * version_str = "1.19 20180219";
+static const char * version_str = "1.20 20180510";
#define ME "sg_ident: "
@@ -208,7 +208,7 @@ main(int argc, char * argv[])
sg_fd = sg_cmds_open_device(device_name, false /* rw=false */, verbose);
if (sg_fd < 0) {
pr2serr(ME "open error: %s: %s\n", device_name, safe_strerror(-sg_fd));
- return SG_LIB_FILE_ERROR;
+ return sg_convert_errno(-sg_fd);
}
memset(rdi_buff, 0x0, sizeof(rdi_buff));
@@ -279,7 +279,12 @@ err_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 == verbose) {
+ if (! sg_if_can2stderr("sg_ident failed: ", ret))
+ pr2serr("Some error occurred, try again with '-v' or '-vv' for "
+ "more information\n");
}
return (ret >= 0) ? ret : SG_LIB_CAT_OTHER;
}
diff --git a/src/sg_logs.c b/src/sg_logs.c
index 283a1831..b99b3254 100644
--- a/src/sg_logs.c
+++ b/src/sg_logs.c
@@ -34,7 +34,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.65 20180501"; /* spc5r19 + sbc4r11 */
+static const char * version_str = "1.66 20180510"; /* spc5r19 + sbc4r11 */
#define MX_ALLOC_LEN (0xfffc)
#define SHORT_RESP_LEN 128
@@ -7071,5 +7071,10 @@ err_out:
free(free_rsp_buff);
if (sg_fd >= 0)
sg_cmds_close_device(sg_fd);
+ if (0 == vb) {
+ if (! sg_if_can2stderr("sg_logs failed: ", ret))
+ pr2serr("Some error occurred, try again with '-v' or '-vv' for "
+ "more information\n");
+ }
return (ret >= 0) ? ret : SG_LIB_CAT_OTHER;
}
diff --git a/src/sg_luns.c b/src/sg_luns.c
index cacb37c6..d99b3481 100644
--- a/src/sg_luns.c
+++ b/src/sg_luns.c
@@ -31,7 +31,7 @@
* and decodes the response.
*/
-static const char * version_str = "1.39 20180425";
+static const char * version_str = "1.40 20180510";
#define MAX_RLUNS_BUFF_LEN (1024 * 1024)
#define DEF_RLUNS_BUFF_LEN (1024 * 8)
@@ -574,7 +574,7 @@ main(int argc, char * argv[])
sg_fd = sg_cmds_open_device(device_name, o_readonly, verbose);
if (sg_fd < 0) {
pr2serr("open error: %s: %s\n", device_name, safe_strerror(-sg_fd));
- return SG_LIB_FILE_ERROR;
+ return sg_convert_errno(-sg_fd);
}
if (decode_arg && (! lu_cong_arg_given)) {
if (verbose > 1)
@@ -679,5 +679,10 @@ the_end:
if (0 == ret)
return SG_LIB_FILE_ERROR;
}
+ if (0 == verbose) {
+ if (! sg_if_can2stderr("sg_luns failed: ", ret))
+ pr2serr("Some error occurred, try again with '-v' or '-vv' for "
+ "more information\n");
+ }
return (ret >= 0) ? ret : SG_LIB_CAT_OTHER;
}