[PATCH] Fix building Samba with GCC 7.1

Andreas Schneider asn at samba.org
Thu Jun 1 13:45:43 UTC 2017


Hi,

the attached patchset addresses some build issues with GCC 7.1.


Review and push much appreciated!


Thanks,


	Andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org
-------------- next part --------------
From 252573e97ba985ac744f3fab0673bd7541127c2b Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 1 Jun 2017 14:16:56 +0200
Subject: [PATCH 1/3] replace: Use the same size as d_name member of struct
 dirent

This fixes an error with GCC 7.1

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/replace/test/os2_delete.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/replace/test/os2_delete.c b/lib/replace/test/os2_delete.c
index 0816f611516..4b99ccf9103 100644
--- a/lib/replace/test/os2_delete.c
+++ b/lib/replace/test/os2_delete.c
@@ -63,7 +63,7 @@ static int os2_delete(DIR *d)
 	off_t offsets[READDIR_SIZE];
 	int i, j;
 	struct dirent *de;
-	char names[READDIR_SIZE][30];
+	char names[READDIR_SIZE][256];
 
 	/* scan, remembering offsets */
 	for (i=0, de=readdir(d); 
-- 
2.13.0


From c62c377b55f881b1239298d2bf353cc6225dd120 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 1 Jun 2017 14:24:42 +0200
Subject: [PATCH 2/3] waf: Do not trhow a format-truncation error for
 test/snprintf.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This fixes building with GCC 7.1

Error:
../lib/replace/test/testsuite.c:355:6: error: ā€˜%dā€™ directive output
truncated writing 1 byte into a region of size 0
[-Werror=format-truncation=]

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 lib/replace/wscript | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/replace/wscript b/lib/replace/wscript
index f681d02af14..581ffd93662 100644
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -707,7 +707,7 @@ def build(bld):
                         source='''test/testsuite.c test/strptime.c
                         test/os2_delete.c test/getifaddrs.c''',
                         deps='replace',
-                        cflags="-Wno-format-zero-length")
+                        cflags="-Wno-format-zero-length -Wno-format-truncation")
 
     if bld.env.standalone_replace:
         bld.SAMBA_BINARY('replace_testsuite',
-- 
2.13.0


From 21f5b021fb355f97fea14b099ec47c04049bb713 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Thu, 1 Jun 2017 14:28:08 +0200
Subject: [PATCH 3/3] s4:torture: Fix comparison between pointer and zero
 character constant

Fixes building with GCC 7.1

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source4/torture/masktest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source4/torture/masktest.c b/source4/torture/masktest.c
index 9c5906fc7c6..9a047e2b708 100644
--- a/source4/torture/masktest.c
+++ b/source4/torture/masktest.c
@@ -160,7 +160,7 @@ static void get_real_name(TALLOC_CTX *mem_ctx, struct smbcli_state *cli,
 		*long_name = strlower_talloc(mem_ctx, last_hit.long_name);
 	}
 
-	if (*short_name == '\0') {
+	if (*short_name[0] == '\0') {
 		*short_name = talloc_strdup(mem_ctx, *long_name);
 	}
 }
-- 
2.13.0



More information about the samba-technical mailing list