diff options
author | Mikel Olasagasti Uranga <mikel@olasagasti.info> | 2022-05-17 12:52:08 +0200 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2022-05-18 12:47:04 -0400 |
commit | 6729ba31a844389bbf4decb77992d228f5dba909 (patch) | |
tree | c4f4a7f30e26b3791c19479ce53aab9f08939ea7 | |
parent | ee8e013cd5398c5fb34fb19a24db0f3b6185bac3 (diff) | |
download | moreutils-6729ba31a844389bbf4decb77992d228f5dba909.tar.gz |
Use pclose() instead of fclose()
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).
Solves the following warning when compiled with -Wmismatched-dealloc:
errno.c: In function ‘search_all’:
errno.c:126:5: warning: ‘fclose’ called on pointer returned from a
mismatched allocation function
[-Wmismatched-dealloc]
126 | fclose(f);
| ^~~~~~~~~
errno.c:113:9: note: returned from ‘popen’
113 | f = popen("locale -a", "r");
| ^~~~~~~~~~~~~~~~~~~~~~~
-rw-r--r-- | errno.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -123,7 +123,7 @@ search_all(int num_words, char **words) search(num_words, words); } - fclose(f); + pclose(f); } |