Opened 10 years ago

Closed 10 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 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by gbechis

Attachment: patch-os_openbsd_cpp added

comment:1 Changed 10 years ago by Christian Franke

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

comment:2 Changed 10 years ago by Christian Franke

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 Changed 10 years ago by gbechis

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

comment:4 Changed 10 years ago by Christian Franke

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