From c68f5b06bcf98842f7a6bd091a7a9b48374d8320 Mon Sep 17 00:00:00 2001
From: samm2 <samm2@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Wed, 7 Oct 2009 00:41:46 +0000
Subject: [PATCH] FreeBSD: moved cciss header checking to the open() function

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2943 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 smartmontools/os_freebsd.cpp | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/smartmontools/os_freebsd.cpp b/smartmontools/os_freebsd.cpp
index de47845f2..b62abb3a9 100644
--- a/smartmontools/os_freebsd.cpp
+++ b/smartmontools/os_freebsd.cpp
@@ -1152,7 +1152,11 @@ bool freebsd_cciss_device::open()
 {
   const char *dev = get_dev_name();
   int fd;
-  
+#ifndef HAVE_DEV_CISS_CISSIO_H
+  pout("CCISS support is not available in this build of smartmontools,\n"
+    "/usr/src/sys/dev/ciss/cissio.h was not available at build time.\n\n");
+  return false;
+#endif  
   if ((fd = ::open(dev,O_RDWR))<0) {
     perror("open failed");
     return false;
@@ -1177,16 +1181,6 @@ bool freebsd_cciss_device::scsi_pass_through(scsi_cmnd_io * iop)
   if (status < 0)
       return set_err(-status);
   return true;
-#else
-  {
-    static int warned = 0;
-    if (!warned) {
-      pout("CCISS support is not available in this build of smartmontools,\n"
-        "/usr/src/sys/dev/ciss/cissio.h was not available at build time.\n\n");
-      warned = 1;
-    }
-  }
-  return -ENOSYS;
 #endif
   // not reached
   return true;
-- 
GitLab