mirror of
https://github.com/troglobit/finit.git
synced 2026-11-13 17:00:16 +00:00
Fix derefernce before NULL check
Found by Coverity Scan Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
e269176a79
commit
8251f1a422
1 file changed
+2
-2
+2
-2
@@ -138,8 +138,7 @@ int run(char *cmd, char *log)
|
|||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (0 == pid) {
|
if (0 == pid) {
|
||||||
char *pfx = *log ? ": " : "";
|
char *pfx, buf[256];
|
||||||
char buf[256];
|
|
||||||
FILE *pp;
|
FILE *pp;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@@ -155,6 +154,7 @@ int run(char *cmd, char *log)
|
|||||||
if (!pp)
|
if (!pp)
|
||||||
_exit(EX_OSERR);
|
_exit(EX_OSERR);
|
||||||
|
|
||||||
|
pfx = *log ? ": " : "";
|
||||||
while (fgets(buf, sizeof(buf), pp)) {
|
while (fgets(buf, sizeof(buf), pp)) {
|
||||||
chomp(buf);
|
chomp(buf);
|
||||||
logit(LOG_NOTICE, "%s%s%s", log, pfx, buf);
|
logit(LOG_NOTICE, "%s%s%s", log, pfx, buf);
|
||||||
|
|||||||
Reference in new issue
Block a user