Skip to content
Snippets Groups Projects
Commit 540530d0 authored by ballen4705's avatar ballen4705
Browse files

smartd: close file descriptors of SCSI device if not SMART capable

added new temperature attribute (231, temperature)
smartd: now open ATA disks using O_RDONLY
 ----------------------------------------------------------------------


git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@111 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 33f02c29
No related branches found
No related tags found
No related merge requests found
CHANGELOG for smartmontools
$Id: CHANGELOG,v 1.18 2002/10/24 10:53:50 ballen4705 Exp $
$Id: CHANGELOG,v 1.19 2002/10/24 11:38:11 ballen4705 Exp $
Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
......@@ -26,6 +26,11 @@ NOTES FOR NEXT RELEASE:
Next release: handle extended error and self-test logs gracefully.
Parse and print attribute flag meanings
smartmontools-5.0-12
smartd: close file descriptors of SCSI device if not SMART capable
added new temperature attribute (231, temperature)
smartd: now open ATA disks using O_RDONLY
smartmontools-5.0-11
......
......@@ -4,7 +4,7 @@ Home page of code is: http://smartmontools.sourceforge.net
Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
$Id: TODO,v 1.12 2002/10/24 10:31:02 ballen4705 Exp $
$Id: TODO,v 1.13 2002/10/24 11:38:11 ballen4705 Exp $
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 the Free
......@@ -50,7 +50,6 @@ Print flags meanings in Vendor Attribute list -- not hex value --
Fixes
-----
SCSI code in smartd leaves file descriptors open if SMART not supported..
Fix lots of syntax like if (a != 0)
......
......@@ -37,7 +37,7 @@
#include "ataprint.h"
extern const char *CVSid1, *CVSid2;
const char *CVSid3="$Id: smartd.c,v 1.24 2002/10/24 10:56:10 ballen4705 Exp $"
const char *CVSid3="$Id: smartd.c,v 1.25 2002/10/24 11:38:11 ballen4705 Exp $"
CVSID1 CVSID4 CVSID7;
int daemon_init(void){
......@@ -113,7 +113,7 @@ void atadevicescan ( atadevices_t *devices){
printout(LOG_INFO,"Reading Device %s\n", device);
fd = open ( device , O_RDWR );
fd = open(device, O_RDONLY);
if (fd < 0)
// no such device
continue;
......@@ -164,14 +164,17 @@ void scsidevicescan ( scsidevices_t *devices){
fd=open (device, O_RDWR);
if ( fd >= 0 && !testunitready (fd)) {
if (modesense ( fd, 0x1c, (UINT8 *) &tBuf) != 0){
if (fd<0)
continue;
if (!testunitready (fd)) {
if (modesense(fd, 0x1c, (UINT8 *) &tBuf)){
printout(LOG_INFO,"Device: %s, Failed read of ModePage 1C \n", device);
close(fd);
}
else
if ( scsiSmartSupport( fd, (UINT8 *) &smartsupport) == 0){
if (!(smartsupport & DEXCPT_ENABLE)){
if (!scsiSmartSupport( fd, (UINT8 *) &smartsupport) &&
!(smartsupport & DEXCPT_ENABLE)){
devices[numscsidevices].fd = fd;
strcpy(devices[numscsidevices].devicename,device);
......@@ -193,7 +196,8 @@ void scsidevicescan ( scsidevices_t *devices){
}
numscsidevices++;
}
}
else
close(fd);
}
}
}
......
......@@ -37,7 +37,7 @@
#include "ataprint.h"
extern const char *CVSid1, *CVSid2;
const char *CVSid3="$Id: smartd.cpp,v 1.24 2002/10/24 10:56:10 ballen4705 Exp $"
const char *CVSid3="$Id: smartd.cpp,v 1.25 2002/10/24 11:38:11 ballen4705 Exp $"
CVSID1 CVSID4 CVSID7;
int daemon_init(void){
......@@ -113,7 +113,7 @@ void atadevicescan ( atadevices_t *devices){
printout(LOG_INFO,"Reading Device %s\n", device);
fd = open ( device , O_RDWR );
fd = open(device, O_RDONLY);
if (fd < 0)
// no such device
continue;
......@@ -164,14 +164,17 @@ void scsidevicescan ( scsidevices_t *devices){
fd=open (device, O_RDWR);
if ( fd >= 0 && !testunitready (fd)) {
if (modesense ( fd, 0x1c, (UINT8 *) &tBuf) != 0){
if (fd<0)
continue;
if (!testunitready (fd)) {
if (modesense(fd, 0x1c, (UINT8 *) &tBuf)){
printout(LOG_INFO,"Device: %s, Failed read of ModePage 1C \n", device);
close(fd);
}
else
if ( scsiSmartSupport( fd, (UINT8 *) &smartsupport) == 0){
if (!(smartsupport & DEXCPT_ENABLE)){
if (!scsiSmartSupport( fd, (UINT8 *) &smartsupport) &&
!(smartsupport & DEXCPT_ENABLE)){
devices[numscsidevices].fd = fd;
strcpy(devices[numscsidevices].devicename,device);
......@@ -193,7 +196,8 @@ void scsidevicescan ( scsidevices_t *devices){
}
numscsidevices++;
}
}
else
close(fd);
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment