rpms/xscreensaver/devel xscreensaver-5.00-localfix-restrict.patch, NONE, 1.1

Mamoru Tasaka (mtasaka) fedora-extras-commits at redhat.com
Thu Jun 1 03:56:16 UTC 2006


Author: mtasaka

Update of /cvs/extras/rpms/xscreensaver/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8051

Added Files:
	xscreensaver-5.00-localfix-restrict.patch 
Log Message:


xscreensaver-5.00-localfix-restrict.patch:

--- NEW FILE xscreensaver-5.00-localfix-restrict.patch ---
--- xscreensaver-5.00/hacks/screenhack.c.localefix2	2006-05-24 07:09:58.000000000 +0900
+++ xscreensaver-5.00/hacks/screenhack.c	2006-06-01 08:06:32.000000000 +0900
@@ -166,19 +166,39 @@
 reset_locale (void)
 {
 #ifdef HAVE_SETLOCALE
-  const char *current_locale = setlocale(LC_ALL, "");
-  const char *cmp_locale;
-  int j = 0;
+  /* What locale should be checked??
+   */
+  const int examine_locale[] = {
+#ifdef LC_TIME
+    LC_TIME,
+#endif
+    0
+  };
+  int j;
 
-  while ((cmp_locale = change_locale[j]))
+  for (j = 0; examine_locale[j]; j++)
     {
-      if (!strncmp(current_locale, cmp_locale, strlen(cmp_locale)))
+      const char *current_locale = setlocale(examine_locale[j], NULL);
+      const char *env_locale = setlocale(examine_locale[j], "");
+      const char *cmp_locale;
+
+      if (!env_locale || !*env_locale) 
 	{
-	  setlocale(LC_ALL, "C");
-	  break;
+	  setlocale(examine_locale[j], current_locale);
+	  continue;
+	}
+
+      while ((cmp_locale = change_locale[j]))
+	{
+	  if (!strncmp(env_locale, cmp_locale, strlen(cmp_locale)))
+	    {
+	      (void) setlocale(examine_locale[j], "C");
+	      continue;
+	    }
+	  j++;
 	}
-      j++;
     }
+
 #endif /* HAVE_SETLOCALE */
 }
 




More information about the scm-commits mailing list