more checks for lock syserr failure
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 2 Sep 1993 22:43:44 +0000 (14:43 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 2 Sep 1993 22:43:44 +0000 (14:43 -0800)
SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.31

usr/src/usr.sbin/sendmail/src/conf.c

index 86ce0cc..3eac87a 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     8.30 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     8.31 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -1567,8 +1567,17 @@ lockfile(fd, filename, ext, type)
        }
 
        if (!bitset(LOCK_NB, type) || (errno != EACCES && errno != EAGAIN))
        }
 
        if (!bitset(LOCK_NB, type) || (errno != EACCES && errno != EAGAIN))
-               syserr("cannot lockf(%s%s, fd=%d, type=%o)",
-                       filename, ext, fd, type);
+       {
+               int omode = -1;
+#  ifdef F_GETFL
+               int oerrno = errno;
+
+               (void) fcntl(fd, F_GETFL, &omode);
+               errno = oerrno;
+#  endif
+               syserr("cannot lockf(%s%s, fd=%d, type=%o, omode=%o, euid=%d)",
+                       filename, ext, fd, type, omode, geteuid());
+       }
 # else
        if (ext == NULL)
                ext = "";
 # else
        if (ext == NULL)
                ext = "";
@@ -1587,9 +1596,18 @@ lockfile(fd, filename, ext, type)
                printf("(%s) ", errstring(errno));
 
        if (!bitset(LOCK_NB, type) || errno != EWOULDBLOCK)
                printf("(%s) ", errstring(errno));
 
        if (!bitset(LOCK_NB, type) || errno != EWOULDBLOCK)
-               syserr("cannot flock(%s%s, fd=%d, type=%o)",
-                       filename, ext, fd, type);
+       {
+               int omode = -1;
+#  ifdef F_GETFL
+               int oerrno = errno;
+
+               (void) fcntl(fd, F_GETFL, &omode);
+               errno = oerrno;
+#  endif
+               syserr("cannot flock(%s%s, fd=%d, type=%o, omode=%o, euid=%d)",
+                       filename, ext, fd, type, omode, geteuid());
 # endif
 # endif
+       }
        if (tTd(55, 60))
                printf("FAIL\n");
        return FALSE;
        if (tTd(55, 60))
                printf("FAIL\n");
        return FALSE;