From: Andre Noll Date: Sun, 16 Apr 2017 10:18:11 +0000 (+0200) Subject: ipc: Fix error code returned by mutex_lock(). X-Git-Tag: v0.1.7~4 X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=commitdiff_plain;h=01af36ee3cd794f4332c4898828a31aafe0a939f;hp=ee132d4f3e81eaaaeee94ceaf9f960c50bc7d448 ipc: Fix error code returned by mutex_lock(). In the error case do_semop() already returns the error code which corresponds to errno. --- diff --git a/ipc.c b/ipc.c index c6f7e6b..f0a8341 100644 --- a/ipc.c +++ b/ipc.c @@ -285,7 +285,6 @@ static int do_semop(int id, struct sembuf *sops, int num) static int mutex_lock(int id) { struct sembuf sops[4]; - int ret; DSS_DEBUG_LOG(("locking\n")); @@ -305,10 +304,7 @@ static int mutex_lock(int id) sops[3].sem_op = 1; sops[3].sem_flg = SEM_UNDO | IPC_NOWAIT; - ret = do_semop(id, sops, 4); - if (ret < 0) - return -ERRNO_TO_DSS_ERROR(errno); - return 1; + return do_semop(id, sops, 4); } static bool mutex_is_locked(int id)