[PATCH] A Coverity fix
Volker Lendecke
Volker.Lendecke at SerNet.DE
Thu Jul 16 13:42:23 UTC 2015
Hi!
Review&push appreciated!
Thanks,
Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From c288177aa7bd5d2db1fffc52bf3f82979847f4ca Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 16 Jul 2015 15:00:12 +0200
Subject: [PATCH 1/2] vfs: Fix CID 1035384 Unchecked return value from library
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/modules/vfs_default.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 9a0a46e..1c29cb4 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -704,7 +704,13 @@ static bool vfswrap_init_asys_ctx(struct smbd_server_connection *conn)
fd = asys_signalfd(conn->asys_ctx);
- set_blocking(fd, false);
+ ret = set_blocking(fd, false);
+ if (ret != 0) {
+ DBG_WARNING("set_blocking failed: %s\n", strerror(ret));
+ asys_context_destroy(conn->asys_ctx);
+ conn->asys_ctx = NULL;
+ return false;
+ }
conn->asys_fde = tevent_add_fd(conn->ev_ctx, conn, fd,
TEVENT_FD_READ,
--
1.9.1
From 58b45fd5a67ccc00687dba65c6deecc372e133d8 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 16 Jul 2015 15:01:09 +0200
Subject: [PATCH 2/2] vfs: Consolidate failure paths in vfswrap_init_asys_ctx
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/modules/vfs_default.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 1c29cb4..490c4ab 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -707,9 +707,7 @@ static bool vfswrap_init_asys_ctx(struct smbd_server_connection *conn)
ret = set_blocking(fd, false);
if (ret != 0) {
DBG_WARNING("set_blocking failed: %s\n", strerror(ret));
- asys_context_destroy(conn->asys_ctx);
- conn->asys_ctx = NULL;
- return false;
+ goto fail;
}
conn->asys_fde = tevent_add_fd(conn->ev_ctx, conn, fd,
@@ -718,11 +716,14 @@ static bool vfswrap_init_asys_ctx(struct smbd_server_connection *conn)
conn->asys_ctx);
if (conn->asys_fde == NULL) {
DEBUG(1, ("tevent_add_fd failed\n"));
- asys_context_destroy(conn->asys_ctx);
- conn->asys_ctx = NULL;
- return false;
+ goto fail;
}
return true;
+
+fail:
+ asys_context_destroy(conn->asys_ctx);
+ conn->asys_ctx = NULL;
+ return false;
}
struct vfswrap_asys_state {
--
1.9.1
More information about the samba-technical
mailing list