File safte-monitor-fix.patch of Package safte-monitor

--- src/qlogic_api.c
+++ src/qlogic_api.c
@@ -13,7 +13,7 @@
 
 static fc_device_t *qldev_head;
 
-int qlogic_probe(int fd)
+void qlogic_probe(int fd)
 {
     QL_IOCTL ql;
     QL_DISC_PORT qlport;
@@ -24,7 +24,9 @@
     if(qldev_head) return; /* already probed */
 
     if(msizeof(QL_IOCTL, Signature) == 4)
-      strcpy((char*)&ql.Signature, "QLOG");
+      /* We do not NUL-terminate ql.Signature, otherwise we write beyond the
+         end of the string. */
+      strncpy((char*)&ql.Signature, "QLOG", 4);
     else if(msizeof(QL_IOCTL, Signature) == 8)
       strcpy((char*)&ql.Signature, "QLOGIC");
     ql.Version = QL_VERSION;
@@ -85,7 +87,7 @@
 
 }
 
-int qlogic_map_wwn_to_sd()
+void qlogic_map_wwn_to_sd()
 {
     fc_device_t *qldev = qldev_head; 
     scsi_device_t *scsidev;
@@ -95,7 +97,7 @@
     while(qldev->next) {
       for(lun=0; lun<256; lun++) {
 	/* all luns have the same WWPN */
-	if(scsidev = find_dev_by_loc(qldev->host, 0, qldev->id, lun)) {
+	if((scsidev = find_dev_by_loc(qldev->host, 0, qldev->id, lun))) {
 	  scsidev->isfc = 1;
 	  strcpy(scsidev->wwpn, qldev->wwpn);
 	  strcpy(scsidev->wwnn, qldev->wwnn);
--- src/qlogic_api.h
+++ src/qlogic_api.h
@@ -3,8 +3,8 @@
 
 #include <linux/ioctl.h>
 
-extern int qlogic_probe(int fd);
-extern int qlogic_map_wwn_to_sd();
+extern void qlogic_probe(int fd);
+extern void qlogic_map_wwn_to_sd();
 extern void qlogic_free();
 
 #define	INT8	char
--- src/safte-monitor.c
+++ src/safte-monitor.c
@@ -209,7 +209,8 @@
   return 0;
 }
 
-int get_safte_device_insertions(int fd, safte_device_t *safte_dev)
+static void
+get_safte_device_insertions(int fd, safte_device_t *safte_dev)
 {
   unsigned char* buf;
   int i, k;
@@ -222,7 +223,8 @@
 
 }
 
-int get_safte_device_slot_status(int fd, safte_device_t *safte_dev)
+static void
+get_safte_device_slot_status(int fd, safte_device_t *safte_dev)
 {
   unsigned char* buf;
   int i, k;
@@ -238,7 +240,7 @@
 
 }
 
-
+#if 0
 int map_slots_to_devices()
 {
   int i;
@@ -263,7 +265,7 @@
     scsidev = scsidev->next;
   }
 }
-
+#endif
 
 int scan_safte_devices()
 {
@@ -635,7 +637,7 @@
 }
 
 
-int check_safte_status()
+void check_safte_status(void)
 {
   int fd, s;
   safte_device_t *saftedev = saftedev_head;
--- src/safte-monitor.h
+++ src/safte-monitor.h
@@ -137,6 +137,9 @@
   char *desc;
 } safte_status_code_t;
 
+
+extern void check_safte_status(void);
+
 #endif
 
 
openSUSE Build Service is sponsored by