From 22abbb479e00438ec4ab19735824cc6e79dd9aaf Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Wed, 6 Sep 2017 07:35:46 +0200 Subject: [PATCH 108/115] certmap: Suppress warning Wmissing-braces Older version of gcc(e.g. gcc-4.8.5-11.el7) had a false positive warning with c99 struct initialisation "{ 0 }". https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64709 CC src/lib/certmap/libsss_certmap_la-sss_cert_content_nss.lo src/lib/certmap/sss_cert_content_nss.c: In function 'add_pkinit_princ_to_san_list': src/lib/certmap/sss_cert_content_nss.c:475:12: error: missing braces around initializer [-Werror=missing-braces] struct kerberos_principal_name kname = { 0 }; ^ src/lib/certmap/sss_cert_content_nss.c:475:12: error: (near initialization for 'kname.realm') [-Werror=missing-braces] Reviewed-by: Sumit Bose --- src/lib/certmap/sss_cert_content_nss.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/certmap/sss_cert_content_nss.c b/src/lib/certmap/sss_cert_content_nss.c index 9b9409797228e906ce59de2472677cb292692610..925124ccd505cc474e338e676ef2bc20c135dd6c 100644 --- a/src/lib/certmap/sss_cert_content_nss.c +++ b/src/lib/certmap/sss_cert_content_nss.c @@ -472,10 +472,16 @@ static int add_pkinit_princ_to_san_list(TALLOC_CTX *mem_ctx, { struct san_list *i = NULL; SECStatus rv; - struct kerberos_principal_name kname = { 0 }; + /* To avoid 'Wmissing-braces' warnings with older versions of + * gcc kerberos_principal_name cannot be initialized with { 0 } + * but must be initialized with memset(). + */ + struct kerberos_principal_name kname; int ret; size_t c; + memset(&kname, 0, sizeof(kname)); + rv = SEC_ASN1DecodeItem(pool, &kname, kerberos_principal_name_template, &(current->name.OthName.name)); -- 2.14.1