about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
authorFrédéric Bérat <fberat@redhat.com>2023-04-28 14:21:29 +0200
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2023-05-24 21:38:46 -0400
commitd4ad86a0e1ca45517298307bd6ea47a27bd7a346 (patch)
tree782d189f36791036219c8704400645525181c452 /locale
parentda55fae9e277a0c138d4395fee505e5d2f8b2b84 (diff)
downloadglibc-d4ad86a0e1ca45517298307bd6ea47a27bd7a346.tar.gz
glibc-d4ad86a0e1ca45517298307bd6ea47a27bd7a346.tar.xz
glibc-d4ad86a0e1ca45517298307bd6ea47a27bd7a346.zip
locale/programs/locarchive.c: fix warn unused result
Fix unused result warnings, detected when _FORTIFY_SOURCE is enabled in
glibc.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'locale')
-rw-r--r--locale/programs/locarchive.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index 8d7d51af6c..71fd9f34fa 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -1154,10 +1154,14 @@ add_locale_to_archive (struct locarhandle *ah, const char *name,
   if (mask & XPG_NORM_CODESET)
     /* This name contains a codeset in unnormalized form.
        We will store it in the archive with a normalized name.  */
-    asprintf (&normalized_name, "%s%s%s.%s%s%s",
-	      language, territory == NULL ? "" : "_", territory ?: "",
-	      normalized_codeset,
-	      modifier == NULL ? "" : "@", modifier ?: "");
+    if (asprintf (&normalized_name, "%s%s%s.%s%s%s",
+		  language, territory == NULL ? "" : "_", territory ?: "",
+		  normalized_codeset,
+		  modifier == NULL ? "" : "@", modifier ?: "") < 0)
+      {
+	free ((char *) normalized_codeset);
+	return -1;
+      }
 
   /* This call does the main work.  */
   locrec_offset = add_locale (ah, normalized_name ?: name, data, replace);
@@ -1188,10 +1192,14 @@ add_locale_to_archive (struct locarhandle *ah, const char *name,
       normalized_codeset = _nl_normalize_codeset (codeset, strlen (codeset));
       mask |= XPG_NORM_CODESET;
 
-      asprintf (&normalized_codeset_name, "%s%s%s.%s%s%s",
-		language, territory == NULL ? "" : "_", territory ?: "",
-		normalized_codeset,
-		modifier == NULL ? "" : "@", modifier ?: "");
+      if (asprintf (&normalized_codeset_name, "%s%s%s.%s%s%s",
+		    language, territory == NULL ? "" : "_", territory ?: "",
+		    normalized_codeset,
+		    modifier == NULL ? "" : "@", modifier ?: "") < 0)
+	{
+	  free ((char *) normalized_codeset);
+	  return -1;
+	}
 
       add_alias (ah, normalized_codeset_name, replace,
 		 normalized_name ?: name, &locrec_offset);