Skip to content
Snippets Groups Projects
Commit 1fdeb9ba authored by samm2's avatar samm2
Browse files

os_openbsd.cpp,os_netbsd.cpp,os_darwin.cpp - minor fixes related to error handling

git-svn-id: https://svn.code.sf.net/p/smartmontools/code/trunk@4190 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent bea680d7
No related branches found
No related tags found
No related merge requests found
$Id$ $Id$
2015-12-18 Alex Samorukov <samm@os2.kiev.ua>
os_netbsd.cpp, os_openbsd.cpp: fix ioctl returtn value check
os_darwin.cpp: fix error handling
2015-12-16 Douglas Gilbert <dgilbert@interlog.com> 2015-12-16 Douglas Gilbert <dgilbert@interlog.com>
scsiprint.cpp: stop tape drive looking for Solid State media scsiprint.cpp: stop tape drive looking for Solid State media
......
...@@ -312,9 +312,9 @@ static int make_device_names (char*** devlist, const char* name) { ...@@ -312,9 +312,9 @@ static int make_device_names (char*** devlist, const char* name) {
// Create an array of service names. // Create an array of service names.
IOIteratorReset (i); IOIteratorReset (i);
*devlist = (char**)calloc (result, sizeof (char *)); if (! result)
if (! *devlist)
goto error; goto error;
*devlist = (char**)calloc (result, sizeof (char *));
index = 0; index = 0;
while ((device = IOIteratorNext (i)) != MACH_PORT_NULL) { while ((device = IOIteratorNext (i)) != MACH_PORT_NULL) {
if (is_smart_capable (device)) if (is_smart_capable (device))
...@@ -455,7 +455,7 @@ bool darwin_ata_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & ou ...@@ -455,7 +455,7 @@ bool darwin_ata_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & ou
if (select != SHORT_SELF_TEST && select != EXTEND_SELF_TEST) if (select != SHORT_SELF_TEST && select != EXTEND_SELF_TEST)
{ {
errno = EINVAL; errno = EINVAL;
err = -1; return set_err(ENOSYS, "Unsupported SMART self-test mode");
} }
err = smartIf->SMARTExecuteOffLineImmediate (ifp, err = smartIf->SMARTExecuteOffLineImmediate (ifp,
select == EXTEND_SELF_TEST); select == EXTEND_SELF_TEST);
......
...@@ -6,7 +6,7 @@ and monitor storage systems using the Self-Monitoring, Analysis and Reporting ...@@ -6,7 +6,7 @@ and monitor storage systems using the Self-Monitoring, Analysis and Reporting
Technology System (SMART) built into most modern ATA and SCSI harddisks. Technology System (SMART) built into most modern ATA and SCSI harddisks.
In many cases, these utilities will provide advanced warning of disk degradation and failure. In many cases, these utilities will provide advanced warning of disk degradation and failure.
<h2>Installing</h2> <h2>Installing</h2>
To install package click on the smartmontools.pkg icon and follow installation process. To install package click on the smartmontools.pkg icon and follow installation process. Files will be installed to the /usr/local/ directory.
<h2>Usage</h2> <h2>Usage</h2>
If you are having trouble understanding the output of smartctl or smartd, please first read the manual pages installed on your system: If you are having trouble understanding the output of smartctl or smartd, please first read the manual pages installed on your system:
<pre> <pre>
......
...@@ -327,7 +327,8 @@ ata_command_interface(int fd, smart_command_set command, int select, char *data) ...@@ -327,7 +327,8 @@ ata_command_interface(int fd, smart_command_set command, int select, char *data)
return 0; return 0;
} }
if ((retval = ioctl(fd, ATAIOCCOMMAND, &req))) { retval = ioctl(fd, ATAIOCCOMMAND, &req);
if (retval < 0) {
perror("Failed command"); perror("Failed command");
return -1; return -1;
} }
......
...@@ -323,7 +323,8 @@ ata_command_interface(int fd, smart_command_set command, int select, char *data) ...@@ -323,7 +323,8 @@ ata_command_interface(int fd, smart_command_set command, int select, char *data)
unsigned const short normal = WDSMART_CYL, failed = 0x2cf4; unsigned const short normal = WDSMART_CYL, failed = 0x2cf4;
if ((retval = ioctl(fd, ATAIOCCOMMAND, &req))) { retval = ioctl(fd, ATAIOCCOMMAND, &req);
if (retval < 0) {
perror("Failed command"); perror("Failed command");
return -1; return -1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment