ports/75939: smartd can not found SMART device, Only SATA disk installed

Kensaku MASUDA greg at greg.jp
Sat Jan 8 11:00:44 UTC 2005


>Number:         75939
>Category:       ports
>Synopsis:       smartd can not found SMART device, Only SATA disk installed
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 08 11:00:42 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Kensaku MASUDA
>Release:        FreeBSD 5.3-STABLE
>Organization:
>Environment:
FreeBSD omoikane.greg.jp 5.3-STABLE FreeBSD 5.3-STABLE #1: Tue Jan  4 22:55:35 JST 2005     root at omoikane.greg.jp:/a/uzume.greg.rim.or.jp/export/src/system-5-stable/src/sys/i386/compile/omoikane.greg.jp  i386

>Description:
      My freebsd box was i875P based mother board. And it has few
mode for ATA device.
Mode for SATA device connecting to PATA, smartd fount it, And work fine.
Mode for pure SATA, startd can not found it.
>How-To-Repeat:
      Execute smartd in freebsd box what has only SATA device.
>Fix:
      Patch is here.

--- os_freebsd.c.orig   Sat Mar 13 11:32:52 2004
+++ os_freebsd.c        Sat Jan  8 19:35:24 2005
@@ -18,6 +18,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <dirent.h>
+#include <fcntl.h>
 #include <err.h>
 #include <camlib.h>
 #include <cam/scsi/scsi_message.h>
@@ -622,6 +623,10 @@
   glob_t globbuf;
   int i;
   char pattern1[128],pattern2[128];
+  char *patterns[2];
+
+  patterns[0] = pattern1;
+  patterns[1] = pattern2;
 
   bzero(&globbuf,sizeof(globbuf));
   // in case of non-clean exit
@@ -636,8 +641,17 @@
   // to first list. Turn on NOCHECK for second call. This results in no
   // error if no more matches found, however it does append the actual
   // pattern to the list of paths....
-  if ((retglob=glob(pattern1, GLOB_ERR, NULL, &globbuf)) ||
-      (retglob=glob(pattern2, GLOB_ERR|GLOB_APPEND|GLOB_NOCHECK,NULL,&globbuf))) {
+  for(i = 0 ; i < 2 ; i++) {
+    switch(i) {
+    case 0:
+      retglob = glob(patterns[i], GLOB_ERR, NULL, &globbuf);
+      break;
+    default:
+      retglob = glob(patterns[i], GLOB_ERR|GLOB_APPEND|GLOB_NOCHECK, NULL, &globbuf);
+    }
+    if(retglob == 0) {
+      continue;
+    }
      int retval = -1;
     // glob failed
     if (retglob==GLOB_NOSPACE)
@@ -647,9 +661,7 @@
       pout("glob(3) aborted matching patterns (%s),(%s)\n",
            pattern1, pattern2);
     else if (retglob==GLOB_NOMATCH) {
-      pout("glob(3) found no matches for patterns (%s),(%s)\n",
-           pattern1, pattern2);
-      retval = 0;
+      continue;
     }
     else if (retglob)
       pout("Unexplained error in glob(3) of patterns (%s),(%s)\n",
@@ -659,6 +671,11 @@
     globfree(&globbuf);
 
     return retval;
+  }
+  if(globbuf.gl_pathc == 0) {
+    pout("glob(3) found no matches for patterns (%s),(%s)\n",
+       pattern1, pattern2);
+    return 0;
   }
 
   // did we find too many paths?

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list