summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikel Olasagasti Uranga <mikel@olasagasti.info>2022-05-17 12:52:08 +0200
committerJoey Hess <joeyh@joeyh.name>2022-05-18 12:47:04 -0400
commit6729ba31a844389bbf4decb77992d228f5dba909 (patch)
treec4f4a7f30e26b3791c19479ce53aab9f08939ea7
parentee8e013cd5398c5fb34fb19a24db0f3b6185bac3 (diff)
downloadmoreutils-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.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/errno.c b/errno.c
index d2f68a1..fcf3dee 100644
--- a/errno.c
+++ b/errno.c
@@ -123,7 +123,7 @@ search_all(int num_words, char **words)
search(num_words, words);
}
- fclose(f);
+ pclose(f);
}