From eee96526bd1caa8c58046b31705799d87ae10365 Mon Sep 17 00:00:00 2001 From: Chris Leech Date: Fri, 8 Apr 2016 10:55:46 -0700 Subject: iscsiadm: fix parallel rescan handling of exit codes The parallel rescan patches work, in so much as the rescans happen, but if a target is specified the non-matching cases cause warning to be printed and a non-zero exit code. To reproduce: have more than one session to different targets, issue a node mode rescan command to one of them (-m node -T -R). The problem is that while exit() takes an int, only the low byte is part of the exit code and it's combined with other exit status information. iscsiadm tries to use exit(-1) to indicate a non-match (not a fatal error). The value retrieved with wait() after an exit(-1) is actually 65280. Fix this by making use of the wait.h macros for checking the exit code. --- include/iscsi_err.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/iscsi_err.h b/include/iscsi_err.h index 125f443..506bd8c 100644 --- a/include/iscsi_err.h +++ b/include/iscsi_err.h @@ -66,6 +66,8 @@ enum { ISCSI_ERR_AGAIN = 29, /* unknown discovery type */ ISCSI_ERR_UNKNOWN_DISCOVERY_TYPE = 30, + /* child process terminated */ + ISCSI_ERR_CHILD_TERMINATED = 31, /* Always last. Indicates end of error code space */ ISCSI_MAX_ERR_VAL, -- cgit v1.2.1