Message ID | 1357899902-5316-4-git-send-email-armbru@redhat.com |
---|---|
State | New |
Headers | show |
On Fri, Jan 11, 2013 at 11:24:59AM +0100, Markus Armbruster wrote: > Spotted by Coverity. Also document why we keep it open on success. > > Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com> > --- > qga/main.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/qga/main.c b/qga/main.c > index 1a22d8d..db47427 100644 > --- a/qga/main.c > +++ b/qga/main.c > @@ -286,10 +286,12 @@ static bool ga_open_pidfile(const char *pidfile) > goto fail; > } > > + /* keep pidfile open & locked forever */ > return true; > > fail: > unlink(pidfile); > + close(pidfd); > return false; > } > #else /* _WIN32 */ > -- > 1.7.11.7 >
diff --git a/qga/main.c b/qga/main.c index 1a22d8d..db47427 100644 --- a/qga/main.c +++ b/qga/main.c @@ -286,10 +286,12 @@ static bool ga_open_pidfile(const char *pidfile) goto fail; } + /* keep pidfile open & locked forever */ return true; fail: unlink(pidfile); + close(pidfd); return false; } #else /* _WIN32 */
Spotted by Coverity. Also document why we keep it open on success. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- qga/main.c | 2 ++ 1 file changed, 2 insertions(+)