diff options
author | Nigel Croxon <ncroxon@redhat.com> | 2024-07-24 15:20:28 +0200 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-07-30 16:06:45 +0200 |
commit | 87f96c870399cd029933a9742ba72e85e3251c3e (patch) | |
tree | d466c3f790c52117ba79f5435ce8312198da9e8d | |
parent | mdadm: managemon.c fix coverity issues (diff) | |
download | mdadm-87f96c870399cd029933a9742ba72e85e3251c3e.tar.xz mdadm-87f96c870399cd029933a9742ba72e85e3251c3e.zip |
mdadm: msg.c fix coverity issues
Fixing the following coding errors the coverity tools found:
* Event check_return: Calling "fcntl(sfd, 4, fl)" without
checking return value. This library function may fail and
return an error code.
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
-rw-r--r-- | msg.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -176,8 +176,15 @@ int connect_monitor(char *devname) } fl = fcntl(sfd, F_GETFL, 0); + if (fl < 0) { + close(sfd); + return -1; + } fl |= O_NONBLOCK; - fcntl(sfd, F_SETFL, fl); + if (fcntl(sfd, F_SETFL, fl) < 0) { + close(sfd); + return -1; + } return sfd; } |