Commit 4b3cd525 authored by chrfranke's avatar chrfranke
Browse files

Replace some 'EXIT(status)' calls by 'return status'.

Remove unnecessary casts from 'nonempty()' calls.


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@3037 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent fe427fba
......@@ -43,6 +43,9 @@ NOTES FOR FUTURE RELEASES: see TODO file.
<DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
[CF] Replace some 'EXIT(status)' calls by 'return status'.
Remove unnecessary casts from 'nonempty()' calls.
[CF] Windows: Set ata_device::ata_identify_is_cached() return value
according to I/O-control actually used.
......
......@@ -1172,7 +1172,7 @@ static int PrintSmartErrorlog(const ata_smart_errorlog *data,
const ata_smart_errorlog_error_struct * summary = &(elog->error_struct);
// Spec says: unused error log structures shall be zero filled
if (nonempty((unsigned char*)elog,sizeof(*elog))){
if (nonempty(elog, sizeof(*elog))){
// Table 57 of T13/1532D Volume 1 Revision 3
const char *msgstate = get_error_log_state_desc(summary->state);
int days = (int)summary->timestamp/24;
......@@ -1208,7 +1208,7 @@ static int PrintSmartErrorlog(const ata_smart_errorlog *data,
const ata_smart_errorlog_command_struct * thiscommand = elog->commands+j;
// Spec says: unused data command structures shall be zero filled
if (nonempty((unsigned char*)thiscommand,sizeof(*thiscommand))) {
if (nonempty(thiscommand, sizeof(*thiscommand))) {
char timestring[32];
// Convert integer milliseconds to a text-format string
......@@ -1776,7 +1776,7 @@ int ataPrintMain (ata_device * device, const ata_print_options & options)
// If requested, show which presets would be used for this drive and exit.
if (options.show_presets) {
show_presets(&drive, options.fix_swapped_id);
EXIT(0);
return 0;
}
// Use preset vendor attribute options unless user has requested otherwise.
......
......@@ -3,7 +3,7 @@
*
* Home page of code is: http://smartmontools.sourceforge.net
*
* Copyright (C) 2003-8 Eduard Martinescu <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2003-10 Eduard Martinescu <smartmontools-support@lists.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -702,7 +702,7 @@ int freebsd_escalade_device::ata_command_interface(smart_command_set command, in
*data=*(char *)&(ata->sector_count);
// look for nonexistent devices/ports
if (command==IDENTIFY && !nonempty((unsigned char *)data, 512)) {
if (command==IDENTIFY && !nonempty(data, 512)) {
errno=ENODEV;
return -1;
}
......
......@@ -3,12 +3,12 @@
*
* Home page of code is: http://smartmontools.sourceforge.net
*
* Copyright (C) 2003-8 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2003-8 Doug Gilbert <dougg@torque.net>
* Copyright (C) 2008 Hank Wu <hank@areca.com.tw>
* Copyright (C) 2008 Oliver Bock <brevilo@users.sourceforge.net>
* Copyright (C) 2008-9 Christian Franke <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2008 Jordan Hargrave <jordan_hargrave@dell.com>
* Copyright (C) 2003-10 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2003-10 Doug Gilbert <dougg@torque.net>
* Copyright (C) 2008 Hank Wu <hank@areca.com.tw>
* Copyright (C) 2008 Oliver Bock <brevilo@users.sourceforge.net>
* Copyright (C) 2008-10 Christian Franke <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2008 Jordan Hargrave <jordan_hargrave@dell.com>
*
* Parts of this file are derived from code that was
*
......@@ -1622,7 +1622,7 @@ bool linux_escalade_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out
// look for nonexistent devices/ports
if ( in.in_regs.command == ATA_IDENTIFY_DEVICE
&& !nonempty((unsigned char *)in.buffer, in.size)) {
&& !nonempty(in.buffer, in.size)) {
return set_err(ENODEV, "No drive on port %d", m_disknum);
}
......
......@@ -815,7 +815,7 @@ static int smart_ioctl(HANDLE hdevice, int drive, IDEREGS * regs, char * data, u
if (datasize)
memcpy(data, outpar->bBuffer, 512);
else if (regs->bFeaturesReg == ATA_SMART_STATUS) {
if (nonempty(const_cast<unsigned char *>(outpar->bBuffer), sizeof(IDEREGS)))
if (nonempty(outpar->bBuffer, sizeof(IDEREGS)))
*regs = *(const IDEREGS *)(outpar->bBuffer);
else { // Workaround for driver not returning regs
if (con->reportataioctl)
......
/*
* Home page of code is: http://smartmontools.sourceforge.net
*
* Copyright (C) 2002-9 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
* Copyright (C) 2008 Oliver Bock <brevilo@users.sourceforge.net>
* Copyright (C) 2008-9 Christian Franke <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2002-10 Bruce Allen <smartmontools-support@lists.sourceforge.net>
* Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
* Copyright (C) 2008 Oliver Bock <brevilo@users.sourceforge.net>
* Copyright (C) 2008-10 Christian Franke <smartmontools-support@lists.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -4293,8 +4293,7 @@ int main_worker(int argc, char **argv)
}
else {
// exit with configuration file error status
int status = (entries==-3 ? EXIT_READCONF : entries==-2 ? EXIT_NOCONF : EXIT_BADCONF);
EXIT(status);
return (entries==-3 ? EXIT_READCONF : entries==-2 ? EXIT_NOCONF : EXIT_BADCONF);
}
}
......@@ -4310,13 +4309,13 @@ int main_worker(int argc, char **argv)
}
else {
PrintOut(LOG_INFO,"Unable to monitor any SMART enabled devices. Try debug (-d) option. Exiting...\n");
EXIT(EXIT_NODEV);
return EXIT_NODEV;
}
if (quit==4) {
// user has asked to print test schedule
PrintTestSchedule(configs, states, devices);
EXIT(0);
return 0;
}
// reset signal
......@@ -4343,7 +4342,7 @@ int main_worker(int argc, char **argv)
if (quit==3) {
PrintOut(LOG_INFO,"Started with '-q onecheck' option. All devices sucessfully checked once.\n"
"smartd is exiting (exit status 0)\n");
EXIT(0);
return 0;
}
// fork into background if needed
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment