]> xenbits.xensource.com Git - libvirt.git/commitdiff
libvirtd.c: avoid closing a negative socket file descriptor
authorJim Meyering <meyering@redhat.com>
Tue, 2 Feb 2010 10:27:25 +0000 (11:27 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 2 Feb 2010 11:07:27 +0000 (12:07 +0100)
* daemon/libvirtd.c (qemudListenUnix): Close socket only if non-negative.

daemon/libvirtd.c

index 3070dfc17d4cd65b68c1d67c41388ef623ad68be..d858ccfa791df764f24f8e50b6002de95e1d4f51 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * libvirtd.c: daemon start of day, guest process & i/o management
  *
- * Copyright (C) 2006, 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright (C) 2006-2010 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -582,7 +582,7 @@ static int qemudListenUnix(struct qemud_server *server,
     return 0;
 
  cleanup:
-    if (sock->fd)
+    if (sock->fd >= 0)
         close(sock->fd);
     VIR_FREE(sock);
     return -1;