[PATCH] fix some compile warnings

Jeremy Allison jra at samba.org
Thu Dec 12 15:42:24 MST 2013


On Thu, Dec 12, 2013 at 10:28:59PM +0100, Christian Ambach wrote:
> Hi list,
> 
> the attached patchset fixes some compile warnings I get on my
> 64bit Ubuntu using gcc -O3.
> 
> Please review

LGTM - pushed with 2 changes:

1). Initialize fd to -1, not zero in:

 source3/libsmb/cliconnect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 3c9d03a..964d5fd 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -3029,7 +3029,7 @@ static void cli_connect_nb_done(struct tevent_req *subreq)
        struct cli_connect_nb_state *state = tevent_req_data(
                req, struct cli_connect_nb_state);
        NTSTATUS status;
-       int fd;
+       int fd = -1;
        uint16_t port;

(-1 is the correct value to call close() with
if non-initialized. Zero might close a real fd).

2). Initialize ret to -1, not 0 in:

diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c
index 8f182f8..0b6980a 100644
--- a/source3/printing/spoolssd.c
+++ b/source3/printing/spoolssd.c
@@ -372,7 +372,7 @@ static int spoolss_children_main(struct tevent_context *ev_ctx,
 {
        struct spoolss_children_data *data;
        bool ok;
-       int ret;
+       int ret = 1;
 
        ok = spoolss_child_init(ev_ctx, child_id, pf);
        if (!ok) {

as we need to immediately error out if pf->status is invalid.

Jeremy.


More information about the samba-technical mailing list