rpms/smartmontools/devel smartmontools-5.36-cloexec.patch, NONE, 1.1 smartmontools-5.36-sata.patch, NONE, 1.1 smartd.initd, 1.3, 1.4 smartmontools.spec, 1.23, 1.24

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Nov 7 10:19:42 UTC 2006


Author: tmraz

Update of /cvs/dist/rpms/smartmontools/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv20609

Modified Files:
	smartd.initd smartmontools.spec 
Added Files:
	smartmontools-5.36-cloexec.patch smartmontools-5.36-sata.patch 
Log Message:
* Tue Nov  7 2006 Tomas Mraz <tmraz at redhat.com> - 1:5.36-4
- set cloexec on device descriptor so it doesn't leak to sendmail (#214182)
- fixed minor bug in initscript (#213683)
- backported SATA disk detection from upstream


smartmontools-5.36-cloexec.patch:
 os_linux.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

--- NEW FILE smartmontools-5.36-cloexec.patch ---
--- smartmontools-5.36/os_linux.c.cloexec	2006-05-11 09:41:12.000000000 +0200
+++ smartmontools-5.36/os_linux.c	2006-11-07 10:02:55.000000000 +0100
@@ -183,14 +183,14 @@
 
 // equivalent to open(path, flags)
 int deviceopen(const char *pathname, char *type){
+  int fd = -1;
   if (!strcmp(type,"SCSI")) {
-    int fd = open(pathname, O_RDWR | O_NONBLOCK);
+    fd = open(pathname, O_RDWR | O_NONBLOCK);
     if (fd < 0 && errno == EROFS)
       fd = open(pathname, O_RDONLY | O_NONBLOCK);
-    return fd;
   }
   else if (!strcmp(type,"ATA")) 
-    return open(pathname, O_RDONLY | O_NONBLOCK);
+    fd = open(pathname, O_RDONLY | O_NONBLOCK);
   else if (!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
@@ -200,7 +200,7 @@
 	errno=ENXIO;
       return -1;
     }
-    return open(pathname, O_RDONLY | O_NONBLOCK);
+    fd = open(pathname, O_RDONLY | O_NONBLOCK);
   }
   else if (!strcmp(type,"ATA_3WARE_678K")) {
     // the device nodes for this controller are dynamically assigned,
@@ -211,17 +211,21 @@
 	errno=ENXIO;
       return -1;
     }
-    return open(pathname, O_RDONLY | O_NONBLOCK);
+    fd = open(pathname, O_RDONLY | O_NONBLOCK);
   }
   // cciss+
   else if(!strcmp(type, "CCISS"))
   {
     // the device is a cciss smart array device.
-    return open(pathname, O_RDWR | O_NONBLOCK);
+    fd = open(pathname, O_RDWR | O_NONBLOCK);
   }
   else
     return -1;
 
+  if (fd != -1) {
+    fcntl(fd, F_SETFD, FD_CLOEXEC);
+  }
+  return fd;
 }
 
 // equivalent to close(file descriptor)

smartmontools-5.36-sata.patch:
 scsicmds.c  |   25 ++++++++++++++++++++++---
 scsiprint.c |    2 +-
 2 files changed, 23 insertions(+), 4 deletions(-)

--- NEW FILE smartmontools-5.36-sata.patch ---
--- smartmontools-5.33/scsicmds.c.sata	2004-09-05 22:57:43.000000000 +0200
+++ smartmontools-5.33/scsicmds.c	2006-10-25 20:38:01.000000000 +0200
@@ -1979,11 +1979,15 @@
     int k, id_len, c_set, assoc, id_type, i_len;
     unsigned char * ucp;
     unsigned char * ip;
+    unsigned char buff1[20];
+    unsigned char buff2[20];
 
     if (len < 4) {
         /* Device identification VPD page length too short */
         return 0;
     }
+    buff1[0] = '\0';
+    buff2[0] = '\0';
     len -= 4;
     ucp = vpd_di_buff + 4;
     for (k = 0; k < len; k += id_len, ucp += id_len) {
@@ -1997,9 +2001,24 @@
         c_set = (ucp[0] & 0xf);
         assoc = ((ucp[1] >> 4) & 0x3);
         id_type = (ucp[1] & 0xf);
-        if ((0 == id_type) && (2 == c_set) && (0 == assoc) &&
-            (0 == strncmp((const char *)ip,
-                          "Linux ATA-SCSI simulator", i_len))) {
+        if ((0 == id_type) && (2 == c_set) && (0 == assoc)) {
+            /* assoc=lu, c_set=ascii, id_type=vendor */
+            if (0 == strncmp((const char *)ip,
+                             "Linux ATA-SCSI simulator", i_len)) {
+                /* until lk 2.6.16 */
+                return 1;
+            }
+            memcpy(buff1, ip, sizeof(buff1));
+        }
+        if ((1 == id_type) && (2 == c_set) && (0 == assoc)) {
+            /* assoc=lu, c_set=ascii, id_type=t10 vendor id */
+            if (0 == strncmp((const char *)ip, "ATA", 3))
+                memcpy(buff2, ip + 48, sizeof(buff2));
+        }
+    }
+    if (buff1[0] && buff2[0]) {
+        if (0 == memcmp(buff1, buff2, sizeof(buff1))) {
+            /* after lk 2.6.16, look for serial number match */
             return 1;
         }
     }
--- smartmontools-5.33/scsiprint.c.sata	2004-09-06 07:44:54.000000000 +0200
+++ smartmontools-5.33/scsiprint.c	2006-10-25 20:47:58.000000000 +0200
@@ -739,7 +739,7 @@
         /* <<<< This is Linux specific code to detect SATA disks using a
                 SCSI-ATA command translation layer. This may be generalized
                 later when the t10.org SAT project matures. >>>> */
-        req_len = 96;
+        req_len = 252;
         memset(gBuf, 0, req_len);
         if ((err = scsiInquiryVpd(device, 0x83, gBuf, req_len))) {
             PRINT_ON(con);


Index: smartd.initd
===================================================================
RCS file: /cvs/dist/rpms/smartmontools/devel/smartd.initd,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- smartd.initd	27 Jun 2006 15:40:29 -0000	1.3
+++ smartd.initd	7 Nov 2006 10:19:40 -0000	1.4
@@ -37,7 +37,7 @@
     start | reload | restart)
 GEN_CONF="*SMARTD*AUTOGENERATED*"
 [ ! -f /etc/smartd.conf ] || read DUMMY GEN_CONF DUMMY </etc/smartd.conf \
-&& [ $GEN_CONF == "*SMARTD*AUTOGENERATED*" ] \
+&& [ "$GEN_CONF" == "*SMARTD*AUTOGENERATED*" ] \
 && smartd-conf.py 2>/dev/null >/etc/smartd.conf.new-autogenerated \
 && mv -f /etc/smartd.conf.new-autogenerated /etc/smartd.conf
     ;;


Index: smartmontools.spec
===================================================================
RCS file: /cvs/dist/rpms/smartmontools/devel/smartmontools.spec,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- smartmontools.spec	18 Aug 2006 20:17:56 -0000	1.23
+++ smartmontools.spec	7 Nov 2006 10:19:40 -0000	1.24
@@ -1,7 +1,7 @@
 Summary:	Tools for monitoring SMART capable hard disks
 Name:		smartmontools
 Version:	5.36
-Release: 	3
+Release: 	4%{?dist}
 Epoch:		1
 Group:		System Environment/Base
 License:	GPL
@@ -12,6 +12,8 @@
 Source3:	smartd-conf.py
 Source4:	smartmontools.sysconf
 Patch1:		http://people.fedora.de/rsc/smartmontools-5.36-cciss.patch
+Patch2:		smartmontools-5.36-cloexec.patch
+Patch3:		smartmontools-5.36-sata.patch
 
 BuildRoot:	%{_tmppath}/%{name}-%{version}-root
 PreReq:		/sbin/chkconfig /sbin/service
@@ -76,6 +78,11 @@
 
 
 %changelog
+* Tue Nov  7 2006 Tomas Mraz <tmraz at redhat.com> - 1:5.36-4
+- set cloexec on device descriptor so it doesn't leak to sendmail (#214182)
+- fixed minor bug in initscript (#213683)
+- backported SATA disk detection from upstream
+
 * Fri Aug 18 2006 Jesse Keating <jkeating at redhat.com> - 1:5.36-3
 - rebuilt with latest binutils to pick up 64K -z commonpagesize on ppc*
   (#203001)




More information about the fedora-cvs-commits mailing list