[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Thu Sep 18 15:03:03 MDT 2014


The branch, master has been updated
       via  221d9f7 lib: Polish echo_server
       via  ed00ac2 lib: Add EMSGSIZE to map_nt_error_from_unix
       via  b365d44 ctdb_conn: Fix a small memory leak when releasing an IP
       via  81d79e6 messaging4: Fix an error path memleak
       via  041eb5c lib: util_tdb does not need samba-util
       via  02d4b74 tdb_wrap: Only pull in samba-debug
       via  5454f71 lib: Move tdb lock timeout fns to source3
       via  3ffff13 lib: Fix samba-util dep in "errors" module
       via  fb9067c Remove a few #ifdef EWOULDBLOCk
       via  6a1c51e lib: Reduce deps for "smb_transport"
       via  32d190a lib: Make set_blocking() available independently
       via  25df58a lib: Make samba-debug a private library
      from  9fca4f7 s3: vfs module: Adding new vfs module for Symantec VxFS.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 221d9f7b8e833d2b3308736da9689e4ad7d8b281
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Sep 14 20:45:31 2014 +0200

    lib: Polish echo_server
    
    Samba has a lot of struct assignments now, in a lot of cases it simplifies the
    code. Use it in the sample code.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Thu Sep 18 23:02:38 CEST 2014 on sn-devel-104

commit ed00ac21dc54c5bff3331de874f5ab353d39fbdb
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Sep 13 20:44:13 2014 +0200

    lib: Add EMSGSIZE to map_nt_error_from_unix
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit b365d44e15192efd7597f7b7e69bd302dc244c88
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Sep 13 20:06:45 2014 +0200

    ctdb_conn: Fix a small memory leak when releasing an IP
    
    We're exiting anyway, but when in the future we have multichannel this
    might actually be a small leak.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 81d79e6e56f117f05e3ed24e2bcb5bb45376887b
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Sep 14 14:33:53 2014 +0200

    messaging4: Fix an error path memleak
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 041eb5c5bc09dddc6c4d14189247967f685d0a0d
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Sep 14 11:22:36 2014 +0200

    lib: util_tdb does not need samba-util
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 02d4b7470188d25ed06d24b43a82a50c47903aa2
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Sep 14 09:35:24 2014 +0200

    tdb_wrap: Only pull in samba-debug
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 5454f71fc05c551c2465c2d10ee5e0971058bf02
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Sep 14 11:15:34 2014 +0200

    lib: Move tdb lock timeout fns to source3
    
    This is not the nicest code and needs to be replaced. Remove it from
    common.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 3ffff13e0d66ac6f871c3d87d15c5c3c8095ed33
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Sep 17 15:09:52 2014 +0200

    lib: Fix samba-util dep in "errors" module
    
    This piece of code pulls in talloc_stackframe and smb_panic into what
    should be a very simple mapping library. I'm trying to reduce our
    dependencies right now a bit, and I think the use cases that this fixes
    (unknown NTSTATUS together with double nt_errstr() calls in the same
    DEBUG) are rare enough that this is not justified.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit fb9067c789263d5e2fcc26adb46463b974ccdaae
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Sep 17 00:25:38 2014 +0200

    Remove a few #ifdef EWOULDBLOCk
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 6a1c51ee80cb1920248d72dfc79130cb114adad3
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Sep 16 23:11:27 2014 +0200

    lib: Reduce deps for "smb_transport"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 32d190a0209fb3202c71afb193b38f573b545276
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Sep 16 22:39:01 2014 +0200

    lib: Make set_blocking() available independently
    
    async_connect_send() needs this, and I don't want to pull in samba-util
    just for this
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 25df58a853d8d3ecab2705687453193cb676976c
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Sep 18 14:50:50 2014 +0200

    lib: Make samba-debug a private library
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/async_req/wscript_build       |    2 +-
 lib/tdb_wrap/wscript_build        |    2 +-
 lib/tevent/echo_server.c          |    8 ++--
 lib/util/util_tdb.c               |   78 -------------------------------------
 lib/util/util_tdb.h               |   18 --------
 lib/util/wscript_build            |   20 ++++++---
 libcli/smb/wscript                |    4 +-
 libcli/util/nterr.c               |   24 ++++--------
 libcli/util/wscript_build         |    2 +-
 source3/include/util_tdb.h        |   19 +++++++++
 source3/lib/ctdbd_conn.c          |    3 +-
 source3/lib/errmap_unix.c         |    1 +
 source3/lib/recvfile.c            |    8 ----
 source3/lib/sendfile.c            |   20 ---------
 source3/lib/system.c              |   20 ++--------
 source3/lib/unix_msg/unix_msg.c   |    6 ---
 source3/lib/util_tdb.c            |   78 +++++++++++++++++++++++++++++++++++++
 source3/smbd/vfs.c                |    7 +--
 source4/lib/messaging/messaging.c |    1 +
 source4/ntvfs/posix/wscript_build |    2 +-
 20 files changed, 138 insertions(+), 185 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/async_req/wscript_build b/lib/async_req/wscript_build
index 0de58e4..7802935 100644
--- a/lib/async_req/wscript_build
+++ b/lib/async_req/wscript_build
@@ -4,6 +4,6 @@
 bld.SAMBA_SUBSYSTEM('LIBASYNC_REQ',
 	source='async_sock.c',
 	public_deps='talloc tevent',
-	deps='tevent-util'
+	deps='tevent-util socket-blocking'
 	)
 
diff --git a/lib/tdb_wrap/wscript_build b/lib/tdb_wrap/wscript_build
index 0e5532f..7e113c3 100644
--- a/lib/tdb_wrap/wscript_build
+++ b/lib/tdb_wrap/wscript_build
@@ -2,7 +2,7 @@
 
 bld.SAMBA_LIBRARY('tdb-wrap',
                   source='tdb_wrap.c',
-                  deps='tdb talloc samba-util samba-hostconfig',
+                  deps='tdb talloc samba-debug',
                   private_library=True,
                   local_include=False
                  )
diff --git a/lib/tevent/echo_server.c b/lib/tevent/echo_server.c
index a1da0d8..102f7b4 100644
--- a/lib/tevent/echo_server.c
+++ b/lib/tevent/echo_server.c
@@ -619,10 +619,10 @@ int main(int argc, const char **argv)
 		exit(1);
 	}
 
-	memset(&addr, 0, sizeof(addr));
-
-	addr.sin_family = AF_INET;
-	addr.sin_port = htons(port);
+	addr = (struct sockaddr_in) {
+		.sin_family = AF_INET,
+		.sin_port = htons(port)
+	};
 
 	ret = bind(listen_sock, (struct sockaddr *)&addr, sizeof(addr));
 	if (ret == -1) {
diff --git a/lib/util/util_tdb.c b/lib/util/util_tdb.c
index 93df958..811c2a4 100644
--- a/lib/util/util_tdb.c
+++ b/lib/util/util_tdb.c
@@ -317,84 +317,6 @@ int32_t tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int
 	return ret;
 }
 
-static sig_atomic_t gotalarm;
-
-/***************************************************************
- Signal function to tell us we timed out.
-****************************************************************/
-
-static void gotalarm_sig(int signum)
-{
-	gotalarm = 1;
-}
-
-/****************************************************************************
- Lock a chain with timeout (in seconds).
-****************************************************************************/
-
-static int tdb_chainlock_with_timeout_internal( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout, int rw_type)
-{
-	/* Allow tdb_chainlock to be interrupted by an alarm. */
-	int ret;
-	gotalarm = 0;
-
-	if (timeout) {
-		CatchSignal(SIGALRM, gotalarm_sig);
-		tdb_setalarm_sigptr(tdb, &gotalarm);
-		alarm(timeout);
-	}
-
-	if (rw_type == F_RDLCK)
-		ret = tdb_chainlock_read(tdb, key);
-	else
-		ret = tdb_chainlock(tdb, key);
-
-	if (timeout) {
-		alarm(0);
-		tdb_setalarm_sigptr(tdb, NULL);
-		CatchSignal(SIGALRM, SIG_IGN);
-		if (gotalarm && (ret != 0)) {
-			DEBUG(0,("tdb_chainlock_with_timeout_internal: alarm (%u) timed out for key %s in tdb %s\n",
-				timeout, key.dptr, tdb_name(tdb)));
-			/* TODO: If we time out waiting for a lock, it might
-			 * be nice to use F_GETLK to get the pid of the
-			 * process currently holding the lock and print that
-			 * as part of the debugging message. -- mbp */
-			return -1;
-		}
-	}
-
-	return ret == 0 ? 0 : -1;
-}
-
-/****************************************************************************
- Write lock a chain. Return non-zero if timeout or lock failed.
-****************************************************************************/
-
-int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout)
-{
-	return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_WRLCK);
-}
-
-int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
-				   int timeout)
-{
-	TDB_DATA key = string_term_tdb_data(keyval);
-
-	return tdb_chainlock_with_timeout(tdb, key, timeout);
-}
-
-/****************************************************************************
- Read lock a chain by string. Return non-zero if timeout or lock failed.
-****************************************************************************/
-
-int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout)
-{
-	TDB_DATA key = string_term_tdb_data(keyval);
-
-	return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_RDLCK);
-}
-
 /****************************************************************************
  Atomic unsigned integer change. Returns old value. To create, set initial value in *oldval. 
 ****************************************************************************/
diff --git a/lib/util/util_tdb.h b/lib/util/util_tdb.h
index 630bdf6..12c472c 100644
--- a/lib/util/util_tdb.h
+++ b/lib/util/util_tdb.h
@@ -53,24 +53,6 @@ int tdb_read_lock_bystring(struct tdb_context *tdb, const char *keyval);
 void tdb_read_unlock_bystring(struct tdb_context *tdb, const char *keyval);
 
 /****************************************************************************
- Lock a chain, with timeout.
-****************************************************************************/
-int tdb_chainlock_with_timeout( struct tdb_context *tdb, TDB_DATA key,
-				unsigned int timeout);
-
-/****************************************************************************
- Lock a chain by string, with timeout Return non-zero if lock failed.
-****************************************************************************/
-int tdb_lock_bystring_with_timeout(struct tdb_context *tdb, const char *keyval,
-				   int timeout);
-
-/****************************************************************************
- Readlock a chain by string, with timeout Return non-zero if lock failed.
-****************************************************************************/
-int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
-					unsigned int timeout);
-
-/****************************************************************************
  Fetch a int32_t value by a arbitrary blob key, return -1 if not found.
  Output is int32_t in native byte order.
 ****************************************************************************/
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index c9487f2..c148514 100755
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -20,21 +20,27 @@ bld.SAMBA_SUBSYSTEM('close-low-fd',
                     deps='replace',
                     local_include=False)
 
-bld.SAMBA_SUBSYSTEM('samba-debug',
-                    source='debug.c',
-                    deps='replace time-basic close-low-fd talloc',
-                    local_include=False)
+bld.SAMBA_LIBRARY('samba-debug',
+                  source='debug.c',
+                  deps='replace time-basic close-low-fd talloc',
+                  local_include=False,
+                  private_library=True)
+
+bld.SAMBA_LIBRARY('socket-blocking',
+                  source='blocking.c',
+                  local_include=False,
+                  private_library=True)
 
 bld.SAMBA_LIBRARY('samba-util',
                   source='''talloc_stack.c smb_threads.c xfile.c data_blob.c
                     util_file.c time.c rbtree.c rfc1738.c select.c getpass.c
-                    genrand.c fsusage.c blocking.c become_daemon.c
+                    genrand.c fsusage.c become_daemon.c
                     signal.c system.c params.c util.c util_id.c util_net.c
                     util_strlist.c util_paths.c idtree.c fault.c base64.c
                     util_str.c util_str_common.c substitute.c ms_fnmatch.c
                     server_id.c dprintf.c parmlist.c bitmap.c pidfile.c
                     tevent_debug.c util_process.c memcache.c''',
-                  deps='DYNCONFIG time-basic close-low-fd samba-debug tini tiniparser',
+                  deps='DYNCONFIG time-basic close-low-fd samba-debug tini tiniparser socket-blocking',
                   public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid systemd-daemon',
                   public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h dlinklist.h samba_util.h string_wrappers.h',
                   header_path= [ ('dlinklist.h samba_util.h', '.'), ('*', 'util') ],
@@ -67,7 +73,7 @@ bld.SAMBA_SUBSYSTEM('UNIX_PRIVS',
 bld.SAMBA_LIBRARY('util_tdb',
 	source='util_tdb.c',
 	local_include=False,
-	public_deps='tdb talloc samba-util',
+	public_deps='tdb talloc',
 	private_library=True
 	)
 
diff --git a/libcli/smb/wscript b/libcli/smb/wscript
index 17efc97..e6556ce 100755
--- a/libcli/smb/wscript
+++ b/libcli/smb/wscript
@@ -6,8 +6,8 @@ def build(bld):
         source='''
             read_smb.c
         ''',
-        deps='errors LIBASYNC_REQ',
-        public_deps='talloc tevent samba-util',
+        deps='LIBASYNC_REQ',
+        public_deps='talloc tevent',
         private_library=True,
         public_headers='''
             read_smb.h
diff --git a/libcli/util/nterr.c b/libcli/util/nterr.c
index 9f90f7a..dbf399b 100644
--- a/libcli/util/nterr.c
+++ b/libcli/util/nterr.c
@@ -3905,8 +3905,8 @@ NTSTATUS nt_status_squash(NTSTATUS nt_status)
 
 const char *nt_errstr(NTSTATUS nt_code)
 {
+	static char msg[20];
 	int idx = 0;
-	char *result;
 
 	while (nt_errs[idx].nt_errstr != NULL) {
 		if (NT_STATUS_V(nt_errs[idx].nt_errcode) ==
@@ -3916,22 +3916,14 @@ const char *nt_errstr(NTSTATUS nt_code)
 		idx++;
 	}
 
-	if (!talloc_stackframe_exists()) {
-		/* prevent memory leaks from talloc_tos() by using a
-		 * static area. This means the caller will overwrite
-		 * the string with subsequent calls, which can cause
-		 * display of the wrong error. If that happens the
-		 * caller should have a talloc stackframe
-		 */
-		static char msg[20];
-		snprintf(msg, sizeof(msg), "NT code 0x%08x", NT_STATUS_V(nt_code));
-		return msg;
-	}
+	/*
+	 * This should not really happen, we should have all error codes
+	 * available. We have a problem that this might get wrongly
+	 * overwritten by later calls in the same DEBUG statement.
+	 */
 
-	result = talloc_asprintf(talloc_tos(), "NT code 0x%08x",
-				 NT_STATUS_V(nt_code));
-	SMB_ASSERT(result != NULL);
-	return result;
+	snprintf(msg, sizeof(msg), "NT code 0x%08x", NT_STATUS_V(nt_code));
+	return msg;
 }
 
 /************************************************************************
diff --git a/libcli/util/wscript_build b/libcli/util/wscript_build
index 3bfa4b1..ccb882d 100644
--- a/libcli/util/wscript_build
+++ b/libcli/util/wscript_build
@@ -5,7 +5,7 @@ bld.SAMBA_LIBRARY('errors',
                   public_headers='error.h ntstatus.h doserr.h werror.h hresult.h',
                   header_path='core',
                   source='doserr.c errormap.c nterr.c errmap_unix.c hresult.c',
-                  public_deps='talloc samba-util',
+                  public_deps='talloc samba-debug',
                   private_library=True
                   )
 
diff --git a/source3/include/util_tdb.h b/source3/include/util_tdb.h
index c9e9e40..5a58a6b 100644
--- a/source3/include/util_tdb.h
+++ b/source3/include/util_tdb.h
@@ -46,4 +46,23 @@ int tdb_data_cmp(TDB_DATA t1, TDB_DATA t2);
 
 char *tdb_data_string(TALLOC_CTX *mem_ctx, TDB_DATA d);
 
+/****************************************************************************
+ Lock a chain, with timeout.
+****************************************************************************/
+int tdb_chainlock_with_timeout( struct tdb_context *tdb, TDB_DATA key,
+				unsigned int timeout);
+
+/****************************************************************************
+ Lock a chain by string, with timeout Return non-zero if lock failed.
+****************************************************************************/
+int tdb_lock_bystring_with_timeout(struct tdb_context *tdb, const char *keyval,
+				   int timeout);
+
+/****************************************************************************
+ Readlock a chain by string, with timeout Return non-zero if lock failed.
+****************************************************************************/
+int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,
+					unsigned int timeout);
+
+
 #endif /* __TDBUTIL_H__ */
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 3ba8385..a667482 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -415,6 +415,8 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid,
 			DEBUG(10, ("received CTDB_SRVID_RELEASE_IP\n"));
 			ret = conn->release_ip_handler((const char *)msg->data,
 						       conn->release_ip_priv);
+			TALLOC_FREE(hdr);
+
 			if (ret) {
 				/*
 				 * We need to release the ip,
@@ -426,7 +428,6 @@ static NTSTATUS ctdb_read_req(struct ctdbd_connection *conn, uint32_t reqid,
 				conn->release_ip_priv = NULL;
 				return NT_STATUS_ADDRESS_CLOSED;
 			}
-			TALLOC_FREE(hdr);
 			goto next_pkt;
 		}
 
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index c5e190c..56d3f00 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -49,6 +49,7 @@ static const struct {
 	{ ENOSPC,       NT_STATUS_DISK_FULL },
 	{ ENOMEM,       NT_STATUS_NO_MEMORY },
 	{ EISDIR,       NT_STATUS_FILE_IS_A_DIRECTORY},
+	{ EMSGSIZE,	NT_STATUS_PORT_MESSAGE_TOO_LONG },
 #ifdef EPIPE
 	{ EPIPE,        NT_STATUS_CONNECTION_DISCONNECTED},
 #endif
diff --git a/source3/lib/recvfile.c b/source3/lib/recvfile.c
index bffe07f..273c51f 100644
--- a/source3/lib/recvfile.c
+++ b/source3/lib/recvfile.c
@@ -84,11 +84,7 @@ static ssize_t default_sys_recvfile(int fromfd,
 			read_ret = read(fromfd, buffer, toread);
 		} while (read_ret == -1 && errno == EINTR);
 
-#if defined(EWOULDBLOCK)
 		if (read_ret == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
-#else
-		if (read_ret == -1 && (errno == EAGAIN)) {
-#endif
 			/*
 			 * fromfd socket is in non-blocking mode.
 			 * If we already read some and wrote
@@ -209,11 +205,7 @@ ssize_t sys_recvfile(int fromfd,
 				return default_sys_recvfile(fromfd, tofd,
 							    offset, count);
 			}
-#if defined(EWOULDBLOCK)
 			if (errno == EAGAIN || errno == EWOULDBLOCK) {
-#else
-			if (errno == EAGAIN) {
-#endif
 				/*
 				 * fromfd socket is in non-blocking mode.
 				 * If we already read some and wrote
diff --git a/source3/lib/sendfile.c b/source3/lib/sendfile.c
index d5fd5a6..3d457bd 100644
--- a/source3/lib/sendfile.c
+++ b/source3/lib/sendfile.c
@@ -59,11 +59,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
 		ssize_t nwritten;
 		do {
 			nwritten = sendfile(tofd, fromfd, &offset, total);
-#if defined(EWOULDBLOCK)
 		} while (nwritten == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
-#else
-		} while (nwritten == -1 && (errno == EINTR || errno == EAGAIN));
-#endif
 		if (nwritten == -1) {
 			if (errno == ENOSYS || errno == EINVAL) {
 				/* Ok - we're in a world of pain here. We just sent
@@ -139,11 +135,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
 		xferred = 0;
 
 			nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
-#if defined(EWOULDBLOCK)
 		if  (nwritten == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)) {
-#else
-		if (nwritten == -1 && (errno == EINTR || errno == EAGAIN)) {
-#endif
 			if (xferred == 0)
 				continue; /* Nothing written yet. */
 			else
@@ -213,11 +205,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
 
 		do {
 			nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
-#if defined(EWOULDBLOCK)
 		} while (nwritten == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
-#else
-		} while (nwritten == -1 && (errno == EINTR || errno == EAGAIN));
-#endif
 		if (nwritten == -1)
 			return -1;
 		if (nwritten == 0)
@@ -282,11 +270,7 @@ ssize_t sys_sendfile(int tofd, int fromfd,
 #else
 		ret = sendfile(fromfd, tofd, offset, count, &sf_header, &nwritten, 0);
 #endif
-#if defined(EWOULDBLOCK)
 		if (ret == -1 && errno != EINTR && errno != EAGAIN && errno != EWOULDBLOCK) {
-#else
-		if (ret == -1 && errno != EINTR && errno != EAGAIN) {
-#endif
 			/* Send failed, we are toast. */
 			return -1;
 		}
@@ -364,11 +348,7 @@ ssize_t sys_sendfile(int tofd, int fromfd, const DATA_BLOB *header, off_t offset
 		*/
 		do {
 			ret = send_file(&tofd, &hdtrl, 0);
-#if defined(EWOULDBLOCK)
 		} while ((ret == 1) || (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)));
-#else
-		} while ((ret == 1) || (ret == -1 && (errno == EINTR || errno == EAGAIN)));
-#endif
 		if ( ret == -1 )
 			return -1;
 	}
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 698de12..6478e6f 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -62,11 +62,8 @@ ssize_t sys_read(int fd, void *buf, size_t count)
 
 	do {
 		ret = read(fd, buf, count);
-#if defined(EWOULDBLOCK)
 	} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
-#else
-	} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-#endif
+
 	return ret;
 }
 
@@ -80,11 +77,8 @@ ssize_t sys_write(int fd, const void *buf, size_t count)
 
 	do {
 		ret = write(fd, buf, count);
-#if defined(EWOULDBLOCK)
 	} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
-#else
-	} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-#endif
+
 	return ret;
 }
 
@@ -109,11 +103,8 @@ ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt)
 
 	do {
 		ret = writev(fd, iov, iovcnt);
-#if defined(EWOULDBLOCK)
 	} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
-#else
-	} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-#endif
+
 	return ret;
 }
 
@@ -159,11 +150,8 @@ ssize_t sys_send(int s, const void *msg, size_t len, int flags)
 
 	do {
 		ret = send(s, msg, len, flags);
-#if defined(EWOULDBLOCK)
 	} while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
-#else
-	} while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-#endif
+
 	return ret;
 }
 
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c
index 00438ce..982ae46 100644
--- a/source3/lib/unix_msg/unix_msg.c
+++ b/source3/lib/unix_msg/unix_msg.c
@@ -246,9 +246,7 @@ static void unix_dgram_recv_handler(struct poll_watch *w, int fd, short events,
 	received = recvmsg(fd, &msg, 0);
 	if (received == -1) {
 		if ((errno == EAGAIN) ||
-#ifdef EWOULDBLOCK
 		    (errno == EWOULDBLOCK) ||


-- 
Samba Shared Repository


More information about the samba-cvs mailing list