bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mailutils] bug in locker.c


From: Felix Egli
Subject: [bug-mailutils] bug in locker.c
Date: Tue, 03 Aug 2004 16:57:01 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040618

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.

best regards
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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]