Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37737710
en ru br
ALT Linux repositórios
S:7.2-alt1
5.0: 5.38-alt1
4.1: 5.38-alt1
4.0: 5.38-alt1
3.0: 5.32-alt1

Group :: Monitoramento
RPM: smartmontools

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: smartmontools-5.38-rh-cloexec.patch
Download


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];
 
 // equivalent to open(path, flags)
 int deviceopen(const char *pathname, char *type){
-  int fd;
+  int fd = -1;
 
   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
     // 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)))
-      return open(pathname, O_RDWR | O_NONBLOCK);
+      fd = open(pathname, O_RDWR | O_NONBLOCK);
     else
-      return open(pathname, O_RDONLY | O_NONBLOCK);
+      fd = open(pathname, O_RDONLY | O_NONBLOCK);
   } 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
         errno=ENXIO;
       return -1;
     }
-    return open(pathname, O_RDONLY | O_NONBLOCK);
+    fd = open(pathname, O_RDONLY | O_NONBLOCK);
   }
   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
         errno=ENXIO;
       return -1;
     }
-    return open(pathname, O_RDONLY | O_NONBLOCK);
+    fd = open(pathname, O_RDONLY | O_NONBLOCK);
   }
   else if(0 == 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)
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009