[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 4/4] tools/xenstored: Don't leak a file handle when creating the pidfile



Coverity ID: 1055849

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 tools/xenstore/xenstored_posix.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/xenstore/xenstored_posix.c b/tools/xenstore/xenstored_posix.c
index 25bdf74..0c93e6d 100644
--- a/tools/xenstore/xenstored_posix.c
+++ b/tools/xenstore/xenstored_posix.c
@@ -44,6 +44,8 @@ void write_pidfile(const char *pidfile)
        len = snprintf(buf, sizeof(buf), "%ld\n", (long)getpid());
        if (write(fd, buf, len) != len)
                barf_perror("Writing pid file %s", pidfile);
+
+       close(fd);
 }
 
 /* Stevens. */
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.