Jelajahi Sumber

LibC: Let setlocale() pretend that setting the locale succeeded

By returning nullptr we're telling the caller that setlocale() failed.
Some programs expect setlocale() to succeed so let's pretend that it
did.
Gunnar Beutner 4 tahun lalu
induk
melakukan
4cd45f5875
1 mengubah file dengan 4 tambahan dan 1 penghapusan
  1. 4 1
      Userland/Libraries/LibC/locale.cpp

+ 4 - 1
Userland/Libraries/LibC/locale.cpp

@@ -7,6 +7,7 @@
 #include <assert.h>
 #include <locale.h>
 #include <stdio.h>
+#include <string.h>
 
 extern "C" {
 
@@ -46,7 +47,9 @@ static struct lconv default_locale = {
 
 char* setlocale(int, const char*)
 {
-    return nullptr;
+    static char locale[2];
+    memcpy(locale, "C", 2);
+    return locale;
 }
 
 struct lconv* localeconv()