Title: Bug Fix for SYSV semaphores.

I noticed that sysv semaphores initialize the otime member of the semid_ds structure to 0, but they never update it afterwards.  This field is supposed to be the last operation time.  ie the last time a semctl was done.  In UNIX Network Programming, Stevens suggests using this variable to detect races between multiple processes creating/accessing a sysv semaphore.  Anyway, I looked through the code and came up with the following trivial patch.  Could some one review it and perhaps commit it?  This patch was made against current, but I noticed the bug is there in 4.1.1 and most likely everything before that.


(Pardon the revision numbers, they are from my own repository)

*** sysv_sem.c  2000/09/15 11:11:48
--- sysv_sem.c  2000/12/12 23:44:28
*** 543,548 ****
--- 543,550 ----
+       semaptr->sem_otime = time_second;
        if (eval == 0)
                p->p_retval[0] = rval;

Reply via email to