[hackers] [slstatus] Check return value of pclose() || Laslo Hunhold

From: <git_AT_suckless.org>
Date: Sun, 20 May 2018 01:01:37 +0200 (CEST)

commit b640cc489b65153efcb519feb9038d658b4bf005
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Sun May 20 00:57:24 2018 +0200
Commit: Aaron Marcher <me_AT_drkhsh.at>
CommitDate: Sun May 20 01:01:26 2018 +0200

    Check return value of pclose()

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
_AT_@ -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;
         }
Received on Sun May 20 2018 - 01:01:37 CEST

This archive was generated by hypermail 2.3.0 : Sun May 20 2018 - 01:12:24 CEST