[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-mailutils] bug in locker.c
From: |
Alain Magloire |
Subject: |
Re: [bug-mailutils] bug in locker.c |
Date: |
Fri, 6 Aug 2004 15:00:48 -0400 (EDT) |
>
> Hello!
>
> I found a bug in mailbox/locker.c
> The PID cannot be written to the dotlock-file, because it is opened with
> O_RDONLY. I dont know, if O_RDWR is the correct solution or if this has
> any sideeffects.
>
Yes, it seems like a bug to me the write() should be after the call
to O_CREAT or after the link()
Also the malloc() was not free().
Can you generate a proper patch ?
> Felix
>
>
> if ((fd = open (lock->data.dot.dotlock, O_RDONLY)) == -1)
> ^^^^^^^^
> {
> unlink (lock->data.dot.nfslock);
> return errno;
> }
>
> err = stat_check (lock->data.dot.nfslock, fd, 2);
> if (err)
> {
> unlink (lock->data.dot.nfslock);
> if (err == EINVAL)
> return MU_ERR_LOCK_BAD_LOCK;
> return errno;
> }
>
> unlink (lock->data.dot.nfslock);
>
> /* If no errors, we have the lock. */
> assert (lock->refcnt == 0);
>
> if (lock->flags & MU_LOCKER_PID)
> {
> char buf[16];
> sprintf (buf, "%ld", (long) getpid ());
> write (fd, buf, strlen (buf));
> ^^^^^^^^^^
> }
> close(fd);
>
>
> _______________________________________________
> Bug-mailutils mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-mailutils
>
--
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!