aboutsummaryrefslogtreecommitdiff
path: root/lib/sg_pt_linux.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2018-05-24 01:13:38 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2018-05-24 01:13:38 +0000
commit919290b79eb6649d6d05242180ddb3944ca9521b (patch)
treee2b2f839acafdc5493bb21e81e4361f37c8f4357 /lib/sg_pt_linux.c
parent26e76bf6c671941fec1a8d2b3fb53fcd64993577 (diff)
downloadsg3_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 'lib/sg_pt_linux.c')
-rw-r--r--lib/sg_pt_linux.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/sg_pt_linux.c b/lib/sg_pt_linux.c
index 61dc3536..66842391 100644
--- a/lib/sg_pt_linux.c
+++ b/lib/sg_pt_linux.c
@@ -5,7 +5,7 @@
* license that can be found in the BSD_LICENSE file.
*/
-/* sg_pt_linux version 1.40 20180309 */
+/* sg_pt_linux version 1.41 20180522 */
#include <stdio.h>
@@ -335,16 +335,6 @@ check_pt_file_handle(int dev_fd, const char * device_name, int verbose)
#endif
-/* Returns >= 0 if successful. If error in Unix returns negated errno. */
-int
-scsi_pt_open_device(const char * device_name, bool read_only, int verbose)
-{
- int oflags = O_NONBLOCK;
-
- oflags |= (read_only ? O_RDONLY : O_RDWR);
- return scsi_pt_open_flags(device_name, oflags, verbose);
-}
-
/* Similar to scsi_pt_open_device() but takes Unix style open flags OR-ed */
/* together. The 'flags' argument is advisory and may be ignored. */
/* Returns >= 0 if successful, otherwise returns negated errno. */
@@ -370,6 +360,16 @@ scsi_pt_open_flags(const char * device_name, int flags, int verbose)
return fd;
}
+/* Returns >= 0 if successful. If error in Unix returns negated errno. */
+int
+scsi_pt_open_device(const char * device_name, bool read_only, int verbose)
+{
+ int oflags = O_NONBLOCK;
+
+ oflags |= (read_only ? O_RDONLY : O_RDWR);
+ return scsi_pt_open_flags(device_name, oflags, verbose);
+}
+
/* Returns 0 if successful. If error in Unix returns negated errno. */
int
scsi_pt_close_device(int device_fd)
@@ -390,12 +390,6 @@ construct_scsi_pt_obj_with_fd(int dev_fd, int verbose)
int err;
struct sg_pt_linux_scsi * ptp;
- /* The following 2 lines are temporary. It is to avoid a NULL pointer
- * crash when an old utility is used with a newer library built after
- * the sg_warnings_strm cleanup */
- if (NULL == sg_warnings_strm)
- sg_warnings_strm = stderr;
-
ptp = (struct sg_pt_linux_scsi *)
calloc(1, sizeof(struct sg_pt_linux_scsi));
if (ptp) {