From b640cc489b65153efcb519feb9038d658b4bf005 Mon Sep 17 00:00:00 2001 From: Laslo Hunhold Date: Sun, 20 May 2018 00:57:24 +0200 Subject: [PATCH] Check return value of pclose() --- components/run_command.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/run_command.c b/components/run_command.c index b5eeff0..7ae1b69 100644 --- a/components/run_command.c +++ b/components/run_command.c @@ -16,7 +16,10 @@ run_command(const char *cmd) return NULL; } p = fgets(buf, sizeof(buf) - 1, fp); - pclose(fp); + if (pclose(fp) < 0) { + warn("pclose '%s':", cmd); + return NULL; + } if (!p) { return NULL; }