- /* Send back returned value to session daemon */
- ret = lttcomm_send_unix_sock(sock, &pending, sizeof(pending));
+ if (pending < 0) {
+ /*
+ * An error occured while running the command;
+ * don't send the 'pending' reply as the sessiond
+ * will not read it.
+ */
+ break;
+ }
+
+ /* Send back the command's payload (pending reply). */
+ ret = lttcomm_send_unix_sock(sock, &pending_reply,
+ sizeof(pending_reply));