- fix FD_CLOEXEC on SCSI device file descriptors not being set

This commit is contained in:
Tomas Smetana 2008-03-18 08:04:30 +00:00
parent 32535078be
commit 64c7371fc6
2 changed files with 17 additions and 7 deletions

View File

@ -1,7 +1,7 @@
diff -up smartmontools-5.38/os_linux.cpp.cloexec smartmontools-5.38/os_linux.cpp diff -up smartmontools-5.38/os_linux.cpp.cloexec smartmontools-5.38/os_linux.cpp
--- smartmontools-5.38/os_linux.cpp.cloexec 2008-03-10 10:01:25.000000000 +0100 --- smartmontools-5.38/os_linux.cpp.cloexec 2008-03-04 23:09:47.000000000 +0100
+++ smartmontools-5.38/os_linux.cpp 2008-03-10 10:09:26.000000000 +0100 +++ smartmontools-5.38/os_linux.cpp 2008-03-18 08:28:20.000000000 +0100
@@ -171,7 +171,7 @@ static char prev_scsi_dev[128]; @@ -171,14 +171,13 @@ static char prev_scsi_dev[128];
// equivalent to open(path, flags) // equivalent to open(path, flags)
int deviceopen(const char *pathname, char *type){ int deviceopen(const char *pathname, char *type){
@ -10,7 +10,14 @@ diff -up smartmontools-5.38/os_linux.cpp.cloexec smartmontools-5.38/os_linux.cpp
if (0 == strcmp(type,"SCSI")) { if (0 == strcmp(type,"SCSI")) {
strncpy(prev_scsi_dev, pathname, sizeof(prev_scsi_dev) - 1); strncpy(prev_scsi_dev, pathname, sizeof(prev_scsi_dev) - 1);
@@ -186,9 +186,9 @@ int deviceopen(const char *pathname, cha fd = open(pathname, O_RDWR | O_NONBLOCK);
if (fd < 0 && errno == EROFS)
fd = open(pathname, O_RDONLY | O_NONBLOCK);
- return fd;
} else if (0 == strcmp(type,"ATA")) {
// smartd re-opens SCSI devices with "type"==ATA for some reason.
// If that was a SCSI generic device (e.g. /dev/sg0) then the
@@ -186,9 +185,9 @@ int deviceopen(const char *pathname, cha
// The purpose of the next code line is to limit the scope of // The purpose of the next code line is to limit the scope of
// this change as a release is pending (and smartd needs a rewrite). // this change as a release is pending (and smartd needs a rewrite).
if (0 == strncmp(pathname, prev_scsi_dev, sizeof(prev_scsi_dev))) if (0 == strncmp(pathname, prev_scsi_dev, sizeof(prev_scsi_dev)))
@ -22,7 +29,7 @@ diff -up smartmontools-5.38/os_linux.cpp.cloexec smartmontools-5.38/os_linux.cpp
} else if (0 == strcmp(type,"ATA_3WARE_9000")) { } else if (0 == strcmp(type,"ATA_3WARE_9000")) {
// the device nodes for this controller are dynamically assigned, // the device nodes for this controller are dynamically assigned,
// so we need to check that they exist with the correct major // so we need to check that they exist with the correct major
@@ -198,7 +198,7 @@ int deviceopen(const char *pathname, cha @@ -198,7 +197,7 @@ int deviceopen(const char *pathname, cha
errno=ENXIO; errno=ENXIO;
return -1; return -1;
} }
@ -31,7 +38,7 @@ diff -up smartmontools-5.38/os_linux.cpp.cloexec smartmontools-5.38/os_linux.cpp
} }
else if (0 == strcmp(type,"ATA_3WARE_678K")) { else if (0 == strcmp(type,"ATA_3WARE_678K")) {
// the device nodes for this controller are dynamically assigned, // the device nodes for this controller are dynamically assigned,
@@ -209,15 +209,17 @@ int deviceopen(const char *pathname, cha @@ -209,15 +208,17 @@ int deviceopen(const char *pathname, cha
errno=ENXIO; errno=ENXIO;
return -1; return -1;
} }

View File

@ -1,7 +1,7 @@
Summary: Tools for monitoring SMART capable hard disks Summary: Tools for monitoring SMART capable hard disks
Name: smartmontools Name: smartmontools
Version: 5.38 Version: 5.38
Release: 1%{?dist} Release: 2%{?dist}
Epoch: 1 Epoch: 1
Group: System Environment/Base Group: System Environment/Base
License: GPLv2+ License: GPLv2+
@ -105,6 +105,9 @@ exit 0
%exclude %{_sbindir}/smartd-conf.py[co] %exclude %{_sbindir}/smartd-conf.py[co]
%changelog %changelog
* Tue Mar 18 2008 Tomas Smetana <tsmetana@redhat.com> - 1:5.38-2
- fix FD_CLOEXEC on SCSI device file descriptors not being set
* Mon Mar 10 2008 Tomas Smetana <tsmetana@redhat.com> - 1:5.38-1 * Mon Mar 10 2008 Tomas Smetana <tsmetana@redhat.com> - 1:5.38-1
- new upstream version - new upstream version