From 64c7371fc66ea495d0c27490b8605a70d24ca12c Mon Sep 17 00:00:00 2001 From: Tomas Smetana Date: Mar 18 2008 08:04:30 +0000 Subject: - fix FD_CLOEXEC on SCSI device file descriptors not being set --- diff --git a/smartmontools-5.38-cloexec.patch b/smartmontools-5.38-cloexec.patch index ef31183..db6aebf 100644 --- a/smartmontools-5.38-cloexec.patch +++ b/smartmontools-5.38-cloexec.patch @@ -1,7 +1,7 @@ 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 2008-03-10 10:09:26.000000000 +0100 -@@ -171,7 +171,7 @@ static char prev_scsi_dev[128]; +--- smartmontools-5.38/os_linux.cpp.cloexec 2008-03-04 23:09:47.000000000 +0100 ++++ smartmontools-5.38/os_linux.cpp 2008-03-18 08:28:20.000000000 +0100 +@@ -171,14 +171,13 @@ static char prev_scsi_dev[128]; // equivalent to open(path, flags) 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")) { 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 // this change as a release is pending (and smartd needs a rewrite). 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")) { // the device nodes for this controller are dynamically assigned, // 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; 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")) { // 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; return -1; } diff --git a/smartmontools.spec b/smartmontools.spec index c622c84..9a06112 100644 --- a/smartmontools.spec +++ b/smartmontools.spec @@ -1,7 +1,7 @@ Summary: Tools for monitoring SMART capable hard disks Name: smartmontools Version: 5.38 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 1 Group: System Environment/Base License: GPLv2+ @@ -105,6 +105,9 @@ exit 0 %exclude %{_sbindir}/smartd-conf.py[co] %changelog +* Tue Mar 18 2008 Tomas Smetana - 1:5.38-2 +- fix FD_CLOEXEC on SCSI device file descriptors not being set + * Mon Mar 10 2008 Tomas Smetana - 1:5.38-1 - new upstream version