]> xenbits.xensource.com Git - xen.git/commitdiff
xenstore: correct test for opened logfile in reopen_log()
authorJuergen Gross <jgross@suse.com>
Wed, 22 Feb 2017 15:28:45 +0000 (16:28 +0100)
committerWei Liu <wei.liu2@citrix.com>
Thu, 23 Feb 2017 10:27:38 +0000 (10:27 +0000)
As 0 is a valid file descriptor testing a descriptor to be valid
should be done via >= 0 instead of > 0.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/xenstore/xenstored_core.c

index 1e9b62280b4408067132c3608499bfa1960bccaf..7b16338d8256f4d3f80928e97f870ea2e580d444 100644 (file)
@@ -209,7 +209,7 @@ static void trigger_reopen_log(int signal __attribute__((unused)))
 static void reopen_log(void)
 {
        if (tracefile) {
-               if (tracefd > 0)
+               if (tracefd >= 0)
                        close(tracefd);
 
                tracefd = open(tracefile, O_WRONLY|O_CREAT|O_APPEND, 0600);