Module: kamailio
Branch: 5.4
Commit: 82e00ce32c9a232be1dbd2e0a0e6e6c349e054b0
URL:
https://github.com/kamailio/kamailio/commit/82e00ce32c9a232be1dbd2e0a0e6e6c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-11-19T13:23:06+01:00
exec: debug message when command returns non-zero
(cherry picked from commit e9eee1ead964992a2d81014709755bbfd1e995c9)
---
Modified: src/modules/exec/exec.c
---
Diff:
https://github.com/kamailio/kamailio/commit/82e00ce32c9a232be1dbd2e0a0e6e6c…
Patch:
https://github.com/kamailio/kamailio/commit/82e00ce32c9a232be1dbd2e0a0e6e6c…
---
diff --git a/src/modules/exec/exec.c b/src/modules/exec/exec.c
index 0e809ed8af..763e30816e 100644
--- a/src/modules/exec/exec.c
+++ b/src/modules/exec/exec.c
@@ -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;
}