libvirtd.c: avoid closing a negative socket file descriptor

* daemon/libvirtd.c (qemudListenUnix): Close socket only if non-negative.
This commit is contained in:
Jim Meyering 2010-02-02 11:27:25 +01:00
parent 3db3acb94e
commit c37ff6a1ec

View 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;