diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2021-05-03 05:26:48 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2021-05-03 05:26:48 +0000 |
commit | b2d08c24d50a7b1ff3b30f6a5c34cb4e5a155326 (patch) | |
tree | a6ac3874718c32f5f075bc4b56d461909c42a4dc /lib/sg_pt_win32.c | |
parent | 1b551c7b147d0ed75a841e09d61d39cff1d57a4a (diff) | |
download | sg3_utils-b2d08c24d50a7b1ff3b30f6a5c34cb4e5a155326.tar.gz |
sg_ses: On Windows fix 'No command (cdb) given'
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@898 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib/sg_pt_win32.c')
-rw-r--r-- | lib/sg_pt_win32.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/sg_pt_win32.c b/lib/sg_pt_win32.c index cc56a26d..4ed4a0ad 100644 --- a/lib/sg_pt_win32.c +++ b/lib/sg_pt_win32.c @@ -929,7 +929,17 @@ get_scsi_pt_cdb_buf(const struct sg_pt_base * vp) { const struct sg_pt_win32_scsi * psp = vp->implp; - return (uint8_t *)(spt_direct ? psp->swb_d.spt.Cdb : psp->swb_i.spt.Cdb); + if (spt_direct) { + if (psp->swb_d.spt.CdbLength > 0) + return (uint8_t *)(psp->swb_d.spt.Cdb); + else + return NULL; + } else { + if (psp->swb_i.spt.CdbLength > 0) + return (uint8_t *)(psp->swb_i.spt.Cdb); + else + return NULL; + } } void @@ -1051,7 +1061,7 @@ scsi_pt_direct(struct sg_pt_win32_scsi * psp, struct sg_pt_handle * shp, psp->os_err = 0; if (0 == psp->swb_d.spt.CdbLength) { if (vb) - pr2ws("No command (cdb) given\n"); + pr2ws("%s: No command (cdb) given\n", __func__); return SCSI_PT_DO_BAD_PARAMS; } psp->swb_d.spt.Length = sizeof (SCSI_PASS_THROUGH_DIRECT); @@ -1127,7 +1137,7 @@ scsi_pt_indirect(struct sg_pt_base * vp, struct sg_pt_handle * shp, if (0 == psp->swb_i.spt.CdbLength) { if (vb) - pr2ws("No command (cdb) given\n"); + pr2ws("%s: No command (cdb) given\n", __func__); return SCSI_PT_DO_BAD_PARAMS; } if (psp->dxfer_len > (int)sizeof(psp->swb_i.ucDataBuf)) { |