*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.54 1998/09/10 04:07:59 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.55 1998/10/06 02:31:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
* If the socket exists but nobody has an advisory lock on it we
* can safely delete the file.
*/
- if ((lock_fd = open(sock_path, O_RDONLY | O_NONBLOCK, 0666)) >= 0)
+#ifdef HAVE_FCNTL_SETLK
+ if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK, 0666)) >= 0)
{
struct flock lck;
TPRINTF(TRACE_VERBOSE, "flock failed for %s", sock_path);
close(lock_fd);
}
+#endif /* HAVE_FCNTL_SETLK */
}
else
{
* Open the socket file and get an advisory lock on it. The
* lock_fd is left open to keep the lock.
*/
- if ((lock_fd = open(sock_path, O_RDONLY | O_NONBLOCK, 0666)) >= 0)
+#ifdef HAVE_FCNTL_SETLK
+ if ((lock_fd = open(sock_path, O_WRONLY | O_NONBLOCK, 0666)) >= 0)
{
struct flock lck;
if (fcntl(lock_fd, F_SETLK, &lck) != 0)
TPRINTF(TRACE_VERBOSE, "flock error for %s", sock_path);
}
+#endif /* HAVE_FCNTL_SETLK */
}
listen(fd, SOMAXCONN);
[AC_DEFINE(HAVE_UNION_SEMUN) AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))
+AC_MSG_CHECKING(for fcntl(F_SETLK))
+AC_TRY_LINK([#include <fcntl.h>],
+ [struct flock lck;
+ lck.l_whence = SEEK_SET; lck.l_start = lck.l_len = 0;
+ lck.l_type = F_WRLCK;
+ fcntl(0, F_SETLK, &lck);],
+ [AC_DEFINE(HAVE_FCNTL_SETLK) AC_MSG_RESULT(yes)],
+ AC_MSG_RESULT(no))
+
AC_MSG_CHECKING(for good DBL_MIN)
AC_TRY_RUN([#include <stdlib.h>
#include <math.h>