summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNigel Croxon <ncroxon@redhat.com>2024-07-24 15:20:28 +0200
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>2024-07-30 16:06:45 +0200
commit87f96c870399cd029933a9742ba72e85e3251c3e (patch)
treed466c3f790c52117ba79f5435ce8312198da9e8d
parentmdadm: managemon.c fix coverity issues (diff)
downloadmdadm-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.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/msg.c b/msg.c
index f0772b3f..b6da91d3 100644
--- a/msg.c
+++ b/msg.c
@@ -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;
}