diff --git a/yasnd-ipc.c b/yasnd-ipc.c index beee83c..23e362e 100644 --- a/yasnd-ipc.c +++ b/yasnd-ipc.c @@ -74,9 +74,20 @@ int ipc_queue_loop() if (qbuf.mtype==SMS_SEND_TYPE && sms_send_enable) { log_debug(qbuf.mtext,DEBUG_BASE); - gammu_send_sms(qbuf.mtext); + pid_t pid = fork(); + if (pid < 0) { + log_event("Error: can not fork child :("); + exit(EXIT_FAILURE); + } + // If pid == 0, then we are in the child + if (pid == 0) { + gammu_send_sms(qbuf.mtext); + exit(EXIT_SUCCESS); + } + // wait for SMS sending thread + // STUB: need to react on status, returned by thread + waitpid(pid,NULL,0); } - sleep(6); } }