summaryrefslogtreecommitdiff
blob: c1dbae83810abac3850b43ffe93856225e1c3b95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
fix from upstream for alignment errors

http://ezix.org/project/changeset?new=packages/lshw/development/src/core/scsi.cc%401927&old=packages/lshw/development/src/core/scsi.cc%401923

--- src/core/scsi.cc
+++ src/core/scsi.cc
@@ -566,11 +566,15 @@
     if (fd >= 0)
     {
       int bus = -1;
-      char host[50];
-      int * length = (int*)host;
-      *length = sizeof(host);
-      memset(host, 0, sizeof(host));
-      if (ioctl(fd, SCSI_IOCTL_PROBE_HOST, &host) >= 0)
+      union
+      {
+        char host[50];
+        int length;
+      } tmp;
+      tmp.length = sizeof(tmp.host);
+      memset(tmp.host, 0, sizeof(tmp.host));
+
+      if(ioctl(fd, SCSI_IOCTL_PROBE_HOST, &tmp.length) >= 0)
       {
         if (ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &bus) >= 0)
         {