Opened 14 years ago

Closed 14 years ago

#123 closed defect (fixed)

Option DEVISCAN does not work on OpenBSD >= 4.8

Reported by: gbechis Owned by: Christian Franke
Priority: major Milestone: Release 5.41
Component: smartd Version: 5.40
Keywords: openbsd Cc:

Description

With OpenBSD 4.8 the format of sysctl hw.disknames has changed, a patch is needed to handle the new format.

Attachments (1)

patch-os_openbsd_cpp (688 bytes ) - added by gbechis 14 years ago.

Download all attachments as: .zip

Change History (5)

by gbechis, 14 years ago

Attachment: patch-os_openbsd_cpp added

comment:1 by Christian Franke, 14 years ago

Keywords: openbsd added
Milestone: Release 5.41
Owner: changed from somebody to Christian Franke
Status: newaccepted

comment:2 by Christian Franke, 14 years ago

Did you test the patch with more than one device present?

The strtok(...":") from the patch destroys the saved state of the strtok(...",") from the outer loop:

  for (p = strtok(disknames, ","); p; p = strtok(NULL, ",")) { // <<-------
    if (strncmp(p, prefix, strlen(prefix))) {
      continue;
    }
+   for (u = strtok(p, ":"); u; u = strtok(NULL, ":"));        // <<-------
    mp[n] = (char *)malloc(strlen(net_dev_prefix) + strlen(p) + 2);

The following may work:

  for (p = strtok(disknames, ","); p; p = strtok(NULL, ",")) {
    if (strncmp(p, prefix, strlen(prefix))) {
      continue;
    }
+   char * u = strchr(p, ':');
+   if (u)
+     *u = 0;
    mp[n] = (char *)malloc(strlen(net_dev_prefix) + strlen(p) + 2);

comment:3 by gbechis, 14 years ago

Your diff works, I will commit it to the OpenBSD source tree soon.

comment:4 by Christian Franke, 14 years ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.