Pino Toscano
2014-Aug-18 09:18 UTC
[Libguestfs] [PATCH] daemon: zfile: call pclose instead of fclose
fp was opened with popen, so close it properly. --- daemon/file.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/file.c b/daemon/file.c index 856ab5f..f1be51a 100644 --- a/daemon/file.c +++ b/daemon/file.c @@ -552,12 +552,12 @@ do_zfile (const char *method, const char *path) if (fgets (line, sizeof line, fp) == NULL) { reply_with_perror ("fgets"); - fclose (fp); + pclose (fp); return NULL; } - if (fclose (fp) == -1) { - reply_with_perror ("fclose"); + if (pclose (fp) == -1) { + reply_with_perror ("pclose"); return NULL; } -- 1.9.3
Richard W.M. Jones
2014-Aug-18 09:52 UTC
Re: [Libguestfs] [PATCH] daemon: zfile: call pclose instead of fclose
On Mon, Aug 18, 2014 at 11:18:50AM +0200, Pino Toscano wrote:> fp was opened with popen, so close it properly. > --- > daemon/file.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/daemon/file.c b/daemon/file.c > index 856ab5f..f1be51a 100644 > --- a/daemon/file.c > +++ b/daemon/file.c > @@ -552,12 +552,12 @@ do_zfile (const char *method, const char *path) > > if (fgets (line, sizeof line, fp) == NULL) { > reply_with_perror ("fgets"); > - fclose (fp); > + pclose (fp); > return NULL; > } > > - if (fclose (fp) == -1) { > - reply_with_perror ("fclose"); > + if (pclose (fp) == -1) { > + reply_with_perror ("pclose"); > return NULL; > }ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v