tdm_private_thread *private_thread;
tdm_thread_cb_base *base;
char buffer[1024];
- unsigned int len, i;
+ unsigned int i;
+ int len;
/* DON'T check TDM_MUTEX_IS_LOCKED here */
private_thread = private_loop->private_thread;
private_display = private_loop->dpy;
- len = read(private_thread->pipe[0], buffer, sizeof buffer);
+ do {
+ len = read(private_thread->pipe[0], buffer, sizeof buffer);
+ } while (len < 0 && errno == EINTR);
if (tdm_debug_module & TDM_DEBUG_THREAD)
TDM_INFO("fd(%d) read length(%d)", private_thread->pipe[0], len);
+ if (len < 0) {
+ TDM_ERR("read failed: errno(%d), len(%d) %m", errno, len);
+ return TDM_ERROR_OPERATION_FAILED;
+ }
+
if (len == 0)
return TDM_ERROR_NONE;
if (len < sizeof * base) {
- TDM_NEVER_GET_HERE();
+ TDM_ERR("read failed: len(%d)", len);
return TDM_ERROR_OPERATION_FAILED;
}