[PATCH xawtv3 2/2] Use `pclose` to close file-pointer created with `popen`

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

 



gcc reports:

  x11/man.c: In function 'man':
  x11/man.c:106:5: warning: 'fclose' called on pointer returned from a mismatched allocation function [-Wmismatched-dealloc]
    106 |     fclose(fp);
        |     ^~~~~~~~~~
  x11/man.c:69:10: note: returned from 'popen'
     69 |     fp = popen(line,"r");
        |          ^~~~~~~~~~~~~~~

and the popen(3) man-page states:

  The return value from popen() is a normal standard I/O stream in all respects
  save that it must be closed with pclose() rather than fclose(3).

Signed-off-by: Jeremy Sowden <jeremy@xxxxxxxxxx>
---
 x11/man.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x11/man.c b/x11/man.c
index 482980565a63..b71785c31ab4 100644
--- a/x11/man.c
+++ b/x11/man.c
@@ -103,7 +103,7 @@ man(char *page)
     }
     XtVaSetValues(label,XmNlabelString,xmpage,NULL);
     XmStringFree(xmpage);
-    fclose(fp);
+    pclose(fp);
 }
 
 void
-- 
2.43.0





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux