blob: 27df9b5de3bfc4ecf6b8a043aa074cb767085ede [file] [log] [blame]
Brad Bishopd7bf8c12018-02-25 22:55:05 -05001From ea9ecf4bf305f9509d5822b3823658a40162f43c Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 25 Jul 2017 19:08:21 -0700
4Subject: [PATCH] ssieventmonitor: ordered comparison between pointers and
5 zero, actually with NULL
6
7Comparing which is large or small between a pointer and NULL
8however, looks completely illogical. Ordered comparison of
9two valid pointers is legit, but no pointer will be smaller
10than NULL , so comparing if a pointer is larger than NULL
11simply means if the pointer is not NULL.
12
13Fixes errors found with clang e.g.
14
15| ssieventmonitor.cpp:339:53: error: ordered comparison between pointer and zero ('char *' and 'int')
16| if (fgets(nextline, sizeof(nextline) - 1, mdstat) < 0) {
17| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
18
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20---
21 tools/ssieventmonitor.cpp | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24diff --git a/tools/ssieventmonitor.cpp b/tools/ssieventmonitor.cpp
25index f04b8f0..7a00122 100644
26--- a/tools/ssieventmonitor.cpp
27+++ b/tools/ssieventmonitor.cpp
28@@ -336,7 +336,7 @@ static int _read_mdstat(int fd)
29 if (!strncmp(line, "md", 2)) {
30 if (strstr(line, INACTIVE_STR)) { /* possibly container */
31 char nextline[1024];
32- if (fgets(nextline, sizeof(nextline) - 1, mdstat) < 0) {
33+ if (fgets(nextline, sizeof(nextline) - 1, mdstat) != (char *) NULL) {
34 fclose(mdstat);
35 return 1;
36 }
37--
382.13.3
39