Xinqi Bao's Git

Merge pull request #39 from stoeckmann/fgets
authorAaron Marcher <[email protected]>
Thu, 20 Apr 2017 20:14:56 +0000 (22:14 +0200)
committerGitHub <[email protected]>
Thu, 20 Apr 2017 20:14:56 +0000 (22:14 +0200)
On success, fgets always terminates the result.

slstatus.c

index 6deb68c..ada6441 100644 (file)
@@ -447,7 +447,7 @@ run_command(const char *cmd)
                warn("Failed to get command output for %s", cmd);
                return smprintf("%s", UNKNOWN_STR);
        }
-       fgets(buf, sizeof(buf) - 1, fp);
+       fgets(buf, sizeof(buf), fp);
        pclose(fp);
        buf[sizeof(buf) - 1] = '\0';