Skip to content

Commit

Permalink
exec: debug message when command returns non-zero
Browse files Browse the repository at this point in the history
(cherry picked from commit e9eee1e)
  • Loading branch information
miconda authored and henningw committed Dec 21, 2020
1 parent b37aa27 commit 8cc9193
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/modules/exec/exec.c
Expand Up @@ -326,11 +326,17 @@ int exec_cmd(sip_msg_t *msg, char *cmd)
exit_status = pclose(pipe);
if(WIFEXITED(exit_status)) { /* exited properly .... */
/* return false if script exited with non-zero status */
if(WEXITSTATUS(exit_status) != 0)
if(WEXITSTATUS(exit_status) != 0) {
LM_DBG("cmd %s with non-zero status - exit_status=%d,"
" wexitstatus: %d, errno=%d: %s\n",
cmd, exit_status, WEXITSTATUS(exit_status),
errno, strerror(errno));
ret = -1;
}
} else { /* exited erroneously */
LM_ERR("cmd %s failed. exit_status=%d, errno=%d: %s\n", cmd,
exit_status, errno, strerror(errno));
LM_ERR("cmd %s failed. exit_status=%d, wexitstatus: %d, errno=%d: %s\n",
cmd, exit_status, WEXITSTATUS(exit_status),
errno, strerror(errno));
ret = -1;
}

Expand Down

0 comments on commit 8cc9193

Please sign in to comment.