From b86f1d0ffec54f24b081d2e595a0e0e1495c8205 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Sun, 7 Feb 2021 12:19:39 +0100 Subject: [PATCH] smart_: port to openbsd & macos --- plugins/disk/smart-c/smart_.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/disk/smart-c/smart_.c b/plugins/disk/smart-c/smart_.c index a474259b..007219dd 100644 --- a/plugins/disk/smart-c/smart_.c +++ b/plugins/disk/smart-c/smart_.c @@ -107,7 +107,10 @@ int main(int argc, char **argv) } /* Close command (this is where we get the exit code! */ - i = WEXITSTATUS(pclose(f)); + { + int status = pclose(f); /* using an explicit temp var, to be compatible with macos & openbsd */ + i = WEXITSTATUS(status); + } if (i == 1 || /* smartctl command did not parse */ /*i == 2 || *//* smartctl device open failed */ i == 127) { /* command not found */