--- a/mail.local/mail.local.c
+++ b/mail.local/mail.local.c
@@ -98,22 +98,6 @@ SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.
 #define REALLOC(ptr, size)	(((ptr) == NULL) ? malloc(size) : realloc(ptr, size))
 
 /*
-**  If you don't have flock, you could try using lockf instead.
-*/
-
-#ifdef LDA_USE_LOCKF
-# define flock(a, b)	lockf(a, b, 0)
-# ifdef LOCK_EX
-#  undef LOCK_EX
-# endif
-# define LOCK_EX	F_LOCK
-#endif /* LDA_USE_LOCKF */
-
-#ifndef LOCK_EX
-# include <sys/file.h>
-#endif
-
-/*
 **  If you don't have setreuid, and you have saved uids, and you have
 **  a seteuid() call that doesn't try to emulate using setuid(), then
 **  you can try defining LDA_USE_SETEUID.
@@ -1118,9 +1102,6 @@ deliver(fd, name)
 	**  can't unlink it.  Historically, binmail set the owner/group at
 	**  each mail delivery.  We no longer do this, assuming that if the
 	**  ownership or permissions were changed there was a reason.
-	**
-	**  XXX
-	**  open(2) should support flock'ing the file.
 	*/
 
 tryagain:
@@ -1292,7 +1273,7 @@ tryagain:
 #endif /* 0 */
 
 	/* Wait until we can get a lock on the file. */
-	if (flock(mbfd, LOCK_EX) < 0)
+	if (lockf(mbfd, F_LOCK, 0) < 0)
 	{
 		mailerr("450 4.2.0", "Lock %s: %s", path, sm_errstring(errno));
 		goto err1;
@@ -1409,7 +1390,7 @@ err0:
 		mbfd = open(path, O_WRONLY, 0);
 		if (mbfd < 0 ||
 		    cursize == 0
-		    || flock(mbfd, LOCK_EX) < 0 ||
+		    || lockf(mbfd, F_LOCK, 0) < 0 ||
 		    fstat(mbfd, &sb) < 0 ||
 		    sb.st_size != cursize ||
 		    sb.st_nlink != 1 ||
