Browse code

exec: debug message when command returns non-zero

(cherry picked from commit e9eee1ead964992a2d81014709755bbfd1e995c9)

Daniel-Constantin Mierla authored on 03/11/2020 11:49:33
Showing 1 changed files
... ...
@@ -326,11 +326,17 @@ int exec_cmd(sip_msg_t *msg, char *cmd)
326 326
 	exit_status = pclose(pipe);
327 327
 	if(WIFEXITED(exit_status)) { /* exited properly .... */
328 328
 		/* return false if script exited with non-zero status */
329
-		if(WEXITSTATUS(exit_status) != 0)
329
+		if(WEXITSTATUS(exit_status) != 0) {
330
+			LM_DBG("cmd %s with non-zero status - exit_status=%d,"
331
+					" wexitstatus: %d, errno=%d: %s\n",
332
+					cmd, exit_status, WEXITSTATUS(exit_status),
333
+					errno, strerror(errno));
330 334
 			ret = -1;
335
+		}
331 336
 	} else { /* exited erroneously */
332
-		LM_ERR("cmd %s failed. exit_status=%d, errno=%d: %s\n", cmd,
333
-				exit_status, errno, strerror(errno));
337
+		LM_ERR("cmd %s failed. exit_status=%d, wexitstatus: %d, errno=%d: %s\n",
338
+				cmd, exit_status, WEXITSTATUS(exit_status),
339
+				errno, strerror(errno));
334 340
 		ret = -1;
335 341
 	}
336 342