diff mbox series

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

Message ID 20240815115415.3371544-3-jeremy@azazel.net
State New
Headers show
Series A couple of fixes | expand

Commit Message

Jeremy Sowden Aug. 15, 2024, 11:54 a.m. UTC
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@azazel.net>
---
 x11/man.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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