summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-04-19 17:30:27 +0000
committerJeremy Allison <jra@samba.org>2002-04-19 17:30:27 +0000
commit4f4d25d3e14a297f8ee31917f4307667f7b8a46b (patch)
tree056281ada27f1d7184ab017f7ca3d21c924fd4e3 /source3/lib
parent8bc0e73a4366d79e292c21bebf671a2a2a6e5531 (diff)
downloadsamba-4f4d25d3e14a297f8ee31917f4307667f7b8a46b.tar.gz
samba-4f4d25d3e14a297f8ee31917f4307667f7b8a46b.tar.bz2
samba-4f4d25d3e14a297f8ee31917f4307667f7b8a46b.zip
Fix different args to sys_fcntl without going varargs....
Jeremy. (This used to be commit 65742067e07195048edcee46dae95a58a4a50950)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/system.c17
-rw-r--r--source3/lib/util.c6
2 files changed, 19 insertions, 4 deletions
diff --git a/source3/lib/system.c b/source3/lib/system.c
index eaaa76743a..d9a4bbd83b 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -151,7 +151,22 @@ ssize_t sys_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *f
A fcntl wrapper that will deal with EINTR.
********************************************************************/
-int sys_fcntl(int fd, int cmd, void *arg)
+int sys_fcntl_ptr(int fd, int cmd, void *arg)
+{
+ int ret;
+
+ do {
+ errno = 0;
+ ret = fcntl(fd, cmd, arg);
+ } while (ret == -1 && errno == EINTR);
+ return ret;
+}
+
+/*******************************************************************
+A fcntl wrapper that will deal with EINTR.
+********************************************************************/
+
+int sys_fcntl_long(int fd, int cmd, long arg)
{
int ret;
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 1ee1a9c06a..ea1670ea27 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -552,13 +552,13 @@ int set_blocking(int fd, BOOL set)
#endif
#endif
- if((val = sys_fcntl(fd, F_GETFL, 0)) == -1)
+ if((val = sys_fcntl_long(fd, F_GETFL, 0)) == -1)
return -1;
if(set) /* Turn blocking on - ie. clear nonblock flag */
val &= ~FLAG_TO_SET;
else
val |= FLAG_TO_SET;
- return sys_fcntl( fd, F_SETFL, val);
+ return sys_fcntl_long( fd, F_SETFL, val);
#undef FLAG_TO_SET
}
@@ -1353,7 +1353,7 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type)
lock.l_len = count;
lock.l_pid = 0;
- ret = sys_fcntl(fd,op,&lock);
+ ret = sys_fcntl_ptr(fd,op,&lock);
if (ret == -1 && errno != 0)
DEBUG(3,("fcntl_lock: fcntl lock gave errno %d (%s)\n",errno,strerror(errno)));