diff options
-rw-r--r-- | shell/hush.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/shell/hush.c b/shell/hush.c index ef40e5a06..d105029ff 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1318,8 +1318,11 @@ static const char *get_local_var_value(const char *name) | |||
1318 | return utoa(G.root_ppid); | 1318 | return utoa(G.root_ppid); |
1319 | // bash compat: UID? EUID? | 1319 | // bash compat: UID? EUID? |
1320 | #if ENABLE_HUSH_RANDOM_SUPPORT | 1320 | #if ENABLE_HUSH_RANDOM_SUPPORT |
1321 | if (strcmp(name, "RANDOM") == 0) | 1321 | if (strcmp(name, "RANDOM") == 0) { |
1322 | if (G.random_gen.galois_LFSR == 0) | ||
1323 | INIT_RANDOM_T(&G.random_gen, G.root_pid, monotonic_us()); | ||
1322 | return utoa(next_random(&G.random_gen)); | 1324 | return utoa(next_random(&G.random_gen)); |
1325 | } | ||
1323 | #endif | 1326 | #endif |
1324 | return NULL; | 1327 | return NULL; |
1325 | } | 1328 | } |
@@ -6605,9 +6608,6 @@ int hush_main(int argc, char **argv) | |||
6605 | if (!G.root_pid) { | 6608 | if (!G.root_pid) { |
6606 | G.root_pid = getpid(); | 6609 | G.root_pid = getpid(); |
6607 | G.root_ppid = getppid(); | 6610 | G.root_ppid = getppid(); |
6608 | #if ENABLE_HUSH_RANDOM_SUPPORT | ||
6609 | INIT_RANDOM_T(&G.random_gen, G.root_pid, monotonic_us()); | ||
6610 | #endif | ||
6611 | } | 6611 | } |
6612 | G.global_argv = argv + optind; | 6612 | G.global_argv = argv + optind; |
6613 | G.global_argc = argc - optind; | 6613 | G.global_argc = argc - optind; |
@@ -6696,9 +6696,6 @@ int hush_main(int argc, char **argv) | |||
6696 | G.root_pid = getpid(); | 6696 | G.root_pid = getpid(); |
6697 | G.root_ppid = getppid(); | 6697 | G.root_ppid = getppid(); |
6698 | } | 6698 | } |
6699 | #if ENABLE_HUSH_RANDOM_SUPPORT | ||
6700 | INIT_RANDOM_T(&G.random_gen, G.root_pid, monotonic_us()); | ||
6701 | #endif | ||
6702 | 6699 | ||
6703 | /* If we are login shell... */ | 6700 | /* If we are login shell... */ |
6704 | if (argv[0] && argv[0][0] == '-') { | 6701 | if (argv[0] && argv[0][0] == '-') { |