]> sourceware.org Git - lvm2.git/commitdiff
cleanup: use fputs for plain strings
authorZdenek Kabelac <zkabelac@redhat.com>
Sat, 7 Nov 2015 20:15:05 +0000 (21:15 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 9 Nov 2015 09:22:52 +0000 (10:22 +0100)
Use fputs() when printing plain string,
easier then fprintf which needs to parse it.

Also check fd before close is >= 0 -
it is - but coverity fail to see it, so eliminate
this false-positive warning.

daemons/dmeventd/dmeventd.c

index 6c04c1b1f6fa052103837bc4e5181f8488fa7dd2..b7fff9a4c3341051962ffaf997fff2c6879fccac 100644 (file)
@@ -1956,21 +1956,21 @@ static int _reinstate_registrations(struct dm_event_fifos *fifos)
                    !(dev_name = strtok(NULL, _delim)) ||
                    !(mask = strtok(NULL, _delim)) ||
                    !(timeout = strtok(NULL, _delim))) {
-                       fprintf(stderr, _failed_parsing_msg);
+                       fputs(_failed_parsing_msg, stderr);
                        continue;
                }
 
                errno = 0;
                mask_value = strtoul(mask, &endp, 10);
                if (errno || !endp || *endp) {
-                       fprintf(stderr, _failed_parsing_msg);
+                       fputs(_failed_parsing_msg, stderr);
                        continue;
                }
 
                errno = 0;
                timeout_value = strtoul(timeout, &endp, 10);
                if (errno || !endp || *endp) {
-                       fprintf(stderr, _failed_parsing_msg);
+                       fputs(_failed_parsing_msg, stderr);
                        continue;
                }
 
@@ -2255,9 +2255,9 @@ int main(int argc, char *argv[])
 
        log_notice("dmeventd shutting down.");
 
-       if (close(fifos.client))
+       if (fifos.client >= 0 && close(fifos.client))
                log_sys_error("client close", fifos.client_path);
-       if (close(fifos.server))
+       if (fifos.server >= 0 && close(fifos.server))
                log_sys_error("server close", fifos.server_path);
 
        if (_use_syslog)
This page took 0.035168 seconds and 5 git commands to generate.