Skip to content

Commit

Permalink
lxclock: {un}lock_mutex()
Browse files Browse the repository at this point in the history
thread-safety: s/exit()/_exit()/g

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Aug 23, 2018
1 parent 8701190 commit 1ba7d9b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/lxc/lxclock.c
Expand Up @@ -72,22 +72,23 @@ static void lock_mutex(pthread_mutex_t *l)
{
int ret;

if ((ret = pthread_mutex_lock(l)) != 0) {
fprintf(stderr, "pthread_mutex_lock returned:%d %s\n", ret, strerror(ret));
ret = pthread_mutex_lock(l);
if (ret != 0) {
fprintf(stderr, "%s - Failed acquire mutex", strerror(ret));
dump_stacktrace();
exit(EXIT_FAILURE);
_exit(EXIT_FAILURE);
}
}

static void unlock_mutex(pthread_mutex_t *l)
{
int ret;

if ((ret = pthread_mutex_unlock(l)) != 0) {
fprintf(stderr, "%s: pthread_mutex_unlock returned:%d %s\n",
__FILE__, ret, strerror(ret));
ret = pthread_mutex_unlock(l);
if (ret != 0) {
fprintf(stderr, "%s - Failed to release mutex", strerror(ret));
dump_stacktrace();
exit(EXIT_FAILURE);
_exit(EXIT_FAILURE);
}
}

Expand Down

0 comments on commit 1ba7d9b

Please sign in to comment.