• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

external/busybox


コミットメタ情報

リビジョン3ae2578282187c775247cb2c3cc9f442d9c138e0 (tree)
日時2014-08-05 20:13:28
作者Tanguy Pruvot <tanguy.pruvot@gmai...>
コミッターTanguy Pruvot

ログメッセージ

android: clearenv should not set environ to NULL

Remove the old internal clearenv() function which is
no more required (exported in libc)

Change-Id: I357f6a3b057c366761b481c09b471d7c53d7a419

変更サマリ

差分

--- a/android/android.c
+++ b/android/android.c
@@ -10,12 +10,22 @@
1010 #include <stdlib.h>
1111 #include "libbb.h"
1212
13-/* declared in stdlib.h */
14-int clearenv()
13+#ifndef BIONIC_ICS
14+int clearenv(void)
1515 {
16- environ = NULL;
16+ char **P = environ;
17+
18+ /* should never be NULL */
19+ if (!environ)
20+ environ = (char **)xzalloc(sizeof(char *));
21+
22+ if (P != NULL) {
23+ for (; *P; ++P)
24+ *P = NULL;
25+ }
1726 return 0;
1827 }
28+#endif
1929
2030 /* no /etc/shells anyway */
2131 char *getusershell() { return NULL; }
--- a/libbb/xfuncs_printf.c
+++ b/libbb/xfuncs_printf.c
@@ -322,6 +322,11 @@ char* FAST_FUNC xasprintf(const char *format, ...)
322322
323323 void FAST_FUNC xsetenv(const char *key, const char *value)
324324 {
325+#ifdef __BIONIC__
326+ /* on login, can be NULL, and should not be for bionic */
327+ if (environ == NULL)
328+ bb_error_msg_and_die("environment is not initialized");
329+#endif
325330 if (setenv(key, value, 1))
326331 bb_error_msg_and_die("%s", bb_msg_memory_exhausted);
327332 }