diff options
Diffstat (limited to 'sys/kern/sysv_sem.c')
-rw-r--r-- | sys/kern/sysv_sem.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index a499b27a73f..66afb4ee348 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_sem.c,v 1.26 2004/03/13 07:17:39 tedu Exp $ */ +/* $OpenBSD: sysv_sem.c,v 1.27 2004/03/17 18:04:08 millert Exp $ */ /* $NetBSD: sysv_sem.c,v 1.26 1996/02/09 19:00:25 christos Exp $ */ /* @@ -643,12 +643,6 @@ sys_semop(struct proc *p, void *v, register_t *retval) suptr = NULL; /* sem_undo may have been reallocated */ - if (error != 0) { - error = EINTR; - goto done2; - } - DPRINTF(("semop: good morning!\n")); - /* * Make sure that the semaphore still exists */ @@ -666,6 +660,17 @@ sys_semop(struct proc *p, void *v, register_t *retval) semptr->semzcnt--; else semptr->semncnt--; + + /* + * Is it really morning, or was our sleep interrupted? + * Delayed check of tsleep() return code because we + * need to decrement sem[nz]cnt either way.) + */ + if (error != 0) { + error = EINTR; + goto done2; + } + DPRINTF(("semop: good morning!\n")); } done: |