Skip to content

Commit

Permalink
[worker] Do not silently ignore eventfd write errors
Browse files Browse the repository at this point in the history
Not checking write() return value is a bad practice and causes compilation
warnings with the compilation options that are used during rpm builds.

Add diagnostic logging for write() failures.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Jan 31, 2017
1 parent ab1f289 commit 9580e1f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mce-worker.c
Expand Up @@ -595,7 +595,9 @@ mce_worker_execute(void)
pthread_mutex_unlock(&mw_rsp_mutex);

uint64_t cnt = 1;
write(mw_rsp_evfd, &cnt, sizeof cnt);
if( write(mw_rsp_evfd, &cnt, sizeof cnt) == -1 ) {
mce_log(LL_ERR, "signaling job finished failed: %m");
}
}
}

Expand Down Expand Up @@ -660,7 +662,9 @@ mce_worker_add_job(const char *context, const char *name,
pthread_mutex_unlock(&mw_req_mutex);

uint64_t cnt = 1;
write(mw_req_evfd, &cnt, sizeof cnt);
if( write(mw_req_evfd, &cnt, sizeof cnt) == -1 ) {
mce_log(LL_ERR, "signaling job added failed: %m");
}

EXIT:
return;
Expand Down

0 comments on commit 9580e1f

Please sign in to comment.