[PATCH] Coverity fixes.

Jeremy Allison jra at samba.org
Fri Nov 9 21:25:59 UTC 2018


Trying to get my mojo back by fixing Coverity issues :-).

Please review and push if happy !

Jeremy.
-------------- next part --------------
From 8ba8077fbd4f00f75e1529d60e7be3333efc59b9 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Fri, 9 Nov 2018 11:18:31 -0800
Subject: [PATCH 1/2] s4: lib: messaging. Fix dead code. Coverity CID: 1437973

Signed-off-by: Jeremy Allison <jra at samba.org>
---
 source4/lib/messaging/messaging.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index 935951f3fba..dada565d1be 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -470,10 +470,6 @@ static void imessaging_post_handler(struct tevent_context *ev,
 	imessaging_dgm_recv(ev, state->buf, state->buf_len, NULL, 0,
 			    state->msg_ctx);
 
-	if (state == NULL) {
-		return;
-	}
-
 	state->busy_ref = NULL;
 	TALLOC_FREE(state);
 }
-- 
2.19.1.930.g4563a0d9d0-goog


From 5fa57436cc24856f36d9c9b6e9bfbb52bd75b087 Mon Sep 17 00:00:00 2001
From: Jeremy Allison <jra at samba.org>
Date: Fri, 9 Nov 2018 11:23:21 -0800
Subject: [PATCH 2/2] s3: VFS: Remove logically dead code. Coverity CID:
 1419117

Signed-off-by: Jeremy Allison <jra at samba.org>
---
 source3/smbd/vfs.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 28ebfc92dc7..351cd0a5567 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -787,7 +787,6 @@ const char *vfs_readdirname(connection_struct *conn, void *p,
 int vfs_ChDir(connection_struct *conn, const struct smb_filename *smb_fname)
 {
 	int ret;
-	int saved_errno = 0;
 	struct smb_filename *old_cwd = conn->cwd_fname;
 
 	if (!LastDir) {
@@ -825,7 +824,7 @@ int vfs_ChDir(connection_struct *conn, const struct smb_filename *smb_fname)
 		 * Return to original directory
 		 * and return -1.
 		 */
-		saved_errno = errno;
+		int saved_errno = errno;
 
 		if (old_cwd == NULL) {
 			/*
@@ -860,9 +859,6 @@ int vfs_ChDir(connection_struct *conn, const struct smb_filename *smb_fname)
 	DEBUG(4,("vfs_ChDir got %s\n", conn->cwd_fname->base_name));
 
 	TALLOC_FREE(old_cwd);
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
 	return ret;
 }
 
-- 
2.19.1.930.g4563a0d9d0-goog



More information about the samba-technical mailing list