[PATCH] libc: fix __time_load_locale return code

Alexey Lapshin <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
newlib:
        * libc/locale/timelocal.c: ret variable could have garbage
because
        not initialized. explicit check for __HAVE_LOCALE_INFO__

---
 newlib/libc/locale/timelocal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/newlib/libc/locale/timelocal.c
b/newlib/libc/locale/timelocal.c
index 4b361544a..04ae1142f 100644
--- a/newlib/libc/locale/timelocal.c
+++ b/newlib/libc/locale/timelocal.c
@@ -147,10 +147,11 @@ int
 __time_load_locale (struct __locale_t *locale, const char *name,
 		    void *f_wctomb, const char *charset)
 {
-  int	ret;
+  int	ret = 0;
   struct lc_time_T ti;
   char *bufp = NULL;
 
+#ifdef __HAVE_LOCALE_INFO__
 #ifdef __CYGWIN__
   extern int __set_lc_time_from_win (const char *, const struct
lc_time_T *,
 				     struct lc_time_T *, char **, void
*,
@@ -186,5 +187,6 @@ __time_load_locale (struct __locale_t *locale,
const char *name,
 #else
   /* TODO */
 #endif
+#endif /*__HAVE_LOCALE_INFO__*/
   return (ret);
 }
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.