The Samba-Bugzilla – Attachment 13260 Details for
Bug 12827
Fix building Samba with GCC 7.1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for 4.6
gcc71_v4-6_3.patch (text/plain), 8.07 KB, created by
Andreas Schneider
on 2017-06-07 09:07:52 UTC
(
hide
)
Description:
patch for 4.6
Filename:
MIME Type:
Creator:
Andreas Schneider
Created:
2017-06-07 09:07:52 UTC
Size:
8.07 KB
patch
obsolete
>From 54f29649db3b92737c0cb756594fe6801142a150 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Thu, 1 Jun 2017 14:16:56 +0200 >Subject: [PATCH 1/5] replace: Use the same size as d_name member of struct > dirent > >This fixes an error with GCC 7.1 > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12827 > >Signed-off-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit 94e21c139f9b0c1d28ee85fdcb9b7490cc64e27b) >--- > 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 a55ca05dfa7cf0fe0de7ce89fa187bfdb8a9848b Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Thu, 1 Jun 2017 14:24:42 +0200 >Subject: [PATCH 2/5] 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=] > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12827 > >Signed-off-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> >(cherry picked from commit 1670d00be88108a483f04c9763012504499b99e4) >--- > lib/replace/wscript | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/lib/replace/wscript b/lib/replace/wscript >index ea0d5d09b89..80e8257f9de 100644 >--- a/lib/replace/wscript >+++ b/lib/replace/wscript >@@ -706,7 +706,8 @@ def build(bld): > bld.SAMBA_SUBSYSTEM('replace-test', > source='''test/testsuite.c test/strptime.c > test/os2_delete.c test/getifaddrs.c''', >- deps='replace') >+ deps='replace', >+ cflags="-Wno-format-zero-length -Wno-format-truncation") > > if bld.env.standalone_replace: > bld.SAMBA_BINARY('replace_testsuite', >-- >2.13.0 > > >From 15b7b9b3f7377ffc9d2ec18aeaa5c8d3ae32df30 Mon Sep 17 00:00:00 2001 >From: Andreas Schneider <asn@samba.org> >Date: Thu, 1 Jun 2017 14:28:08 +0200 >Subject: [PATCH 3/5] s4:torture: Fix comparison between pointer and zero > character constant > >Fixes building with GCC 7.1 > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12827 > >Signed-off-by: Andreas Schneider <asn@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> > >(cherry picked from commit 1f4b07e5942235bddcfa999b3575f719752d81c4) >--- > 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 b96c6dabbe5..50a18feb644 100644 >--- a/source4/torture/masktest.c >+++ b/source4/torture/masktest.c >@@ -157,7 +157,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 > > >From d4717def23ff9095726f98bf8b5f629491f0a7d2 Mon Sep 17 00:00:00 2001 >From: Douglas Bagnall <douglas@halo.gen.nz> >Date: Sat, 25 Feb 2017 13:38:17 +1300 >Subject: [PATCH 4/5] ndr tests: silence a harmless warning >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >gcc 7. > >"duplicate âconstâ declaration specifier [-Wduplicate-decl-specifier]" > >Signed-off-by: Douglas Bagnall <douglas@halo.gen.nz> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit f1b2d356585d43f2bac24d5c32cbef4a90c43f36) >--- > source4/torture/ndr/string.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > >diff --git a/source4/torture/ndr/string.c b/source4/torture/ndr/string.c >index b682555dc42..a53acaa5b91 100644 >--- a/source4/torture/ndr/string.c >+++ b/source4/torture/ndr/string.c >@@ -4,18 +4,18 @@ > #include "../lib/util/dlinklist.h" > #include "param/param.h" > >-static const char const *ascii = "ascii"; >+static const char *ascii = "ascii"; > /* the following is equivalent to "kamelÃ¥sÃ¥ öäüÿéèóò" in latin1 */ >-static const char const latin1[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xe5, 0x73, >- 0xe5, 0x20, 0xF6, 0xE4, 0xFC, 0xFF, 0xE9, >- 0xE8, 0xF3, 0xF2, 0x00 }; >+static const char latin1[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xe5, 0x73, >+ 0xe5, 0x20, 0xF6, 0xE4, 0xFC, 0xFF, 0xE9, >+ 0xE8, 0xF3, 0xF2, 0x00 }; > /* the following is equivalent to "kamelÃ¥sÃ¥ âºâºâº öäüÿéèóò" in utf8 */ >-static const char const utf8[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xc3, 0xa5, >- 0x73, 0xc3, 0xa5, 0x20, 0xE2, 0x98, 0xBA, >- 0xE2, 0x98, 0xBA, 0xE2, 0x98, 0xBA, 0x20, >- 0xc3, 0xb6, 0xc3, 0xa4, 0xc3, 0xbc, 0xc3, >- 0xbf, 0xc3, 0xa9, 0xc3, 0xa8, 0xc3, 0xb3, >- 0xc3, 0xb2, 0x00 }; >+static const char utf8[] = { 0x6b, 0x61, 0x6d, 0x65, 0x6c, 0xc3, 0xa5, >+ 0x73, 0xc3, 0xa5, 0x20, 0xE2, 0x98, 0xBA, >+ 0xE2, 0x98, 0xBA, 0xE2, 0x98, 0xBA, 0x20, >+ 0xc3, 0xb6, 0xc3, 0xa4, 0xc3, 0xbc, 0xc3, >+ 0xbf, 0xc3, 0xa9, 0xc3, 0xa8, 0xc3, 0xb3, >+ 0xc3, 0xb2, 0x00 }; > > /* purely for convenience */ > static int fl_ascii_null = LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM; >-- >2.13.0 > > >From 3b673a7d293fc99901fe2ecf3bcb9cab6d11deb1 Mon Sep 17 00:00:00 2001 >From: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Date: Thu, 9 Feb 2017 13:02:52 +1300 >Subject: [PATCH 5/5] shadow_copy_get_shadow_copy_data: fix GCC snprintf > warning > >GCC 7 warns about snprintf truncating a dirent d_name (potentially 255 bytes) to 25 bytes, >even though we have checked that it is 25 long in shadow_copy_match_name(). > >Using strlcpy instead of snprintf lets us check it again, JUST TO BE SURE. > >Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> >Reviewed-by: Andrew Bartlett <abartlet@samba.org> >(cherry picked from commit a091a30a5bd50bc02df3e9c01b11f70c94dbd053) >--- > source3/include/ntioctl.h | 2 +- > source3/modules/vfs_shadow_copy.c | 11 ++++++++++- > 2 files changed, 11 insertions(+), 2 deletions(-) > >diff --git a/source3/include/ntioctl.h b/source3/include/ntioctl.h >index f9e6dd996a7..bd80a30d34a 100644 >--- a/source3/include/ntioctl.h >+++ b/source3/include/ntioctl.h >@@ -30,7 +30,7 @@ > > > /* For FSCTL_GET_SHADOW_COPY_DATA ...*/ >-typedef char SHADOW_COPY_LABEL[25]; >+typedef char SHADOW_COPY_LABEL[25]; /* sizeof("@GMT-2004.02.18-15.44.00") + 1 */ > > struct shadow_copy_data { > /* Total number of shadow volumes currently mounted */ >diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c >index 9b43e85af63..dae70f555e5 100644 >--- a/source3/modules/vfs_shadow_copy.c >+++ b/source3/modules/vfs_shadow_copy.c >@@ -252,6 +252,7 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, > while (True) { > SHADOW_COPY_LABEL *tlabels; > struct dirent *d; >+ int ret; > > d = SMB_VFS_NEXT_READDIR(handle, p, NULL); > if (d == NULL) { >@@ -280,7 +281,15 @@ static int shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle, > return -1; > } > >- snprintf(tlabels[shadow_copy_data->num_volumes++], sizeof(*tlabels), "%s",d->d_name); >+ ret = strlcpy(tlabels[shadow_copy_data->num_volumes], d->d_name, >+ sizeof(tlabels[shadow_copy_data->num_volumes])); >+ if (ret != sizeof(tlabels[shadow_copy_data->num_volumes]) - 1) { >+ DEBUG(0,("shadow_copy_get_shadow_copy_data: malformed label %s\n", >+ d->d_name)); >+ SMB_VFS_NEXT_CLOSEDIR(handle, p); >+ return -1; >+ } >+ shadow_copy_data->num_volumes++; > > shadow_copy_data->labels = tlabels; > } >-- >2.13.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
jra
:
review+
Actions:
View
Attachments on
bug 12827
:
13258
|
13259
| 13260