This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix build warning in locarchive.c


Hi,

I just noticed a minor build warning in locarchive.c where const char
* is being implicitly cast to a char *.  Attached patch fixes this.
OK to commit?

Siddhesh

	* locale/programs/locarchive.c (open_archive): Add const
	qualifier to ARCHIVEFNAME and copy default fname to
	DEFAULT_FNAME.

diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index e796865..88e1172 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -564,15 +564,15 @@ open_archive (struct locarhandle *ah, bool readonly)
   int retry = 0;
   size_t prefix_len = output_prefix ? strlen (output_prefix) : 0;
   char default_fname[prefix_len + sizeof (ARCHIVE_NAME)];
-  char *archivefname = ah->fname;
+  const char *archivefname = ah->fname;
 
   /* If ah has a non-NULL fname open that otherwise open the default.  */
   if (archivefname == NULL)
     {
       archivefname = default_fname;
       if (output_prefix)
-        memcpy (archivefname, output_prefix, prefix_len);
-      strcpy (archivefname + prefix_len, ARCHIVE_NAME);
+        memcpy (default_fname, output_prefix, prefix_len);
+      strcpy (default_fname + prefix_len, ARCHIVE_NAME);
     }
 
   while (1)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]