diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-01-08 14:33:53 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-01-08 14:33:53 +0000 |
commit | 648b9ba08bd610b866b18a39de7a4572c2196cf3 (patch) | |
tree | ae40ed05ad376533dd6005724b9d3925e46a77d1 /scripts/config/conf.c | |
parent | 074a033f4e45691e7b220eab76778aba5bc9b9f6 (diff) | |
download | upstream-648b9ba08bd610b866b18a39de7a4572c2196cf3.tar.gz upstream-648b9ba08bd610b866b18a39de7a4572c2196cf3.tar.bz2 upstream-648b9ba08bd610b866b18a39de7a4572c2196cf3.zip |
scripts/config: sync with linux upstream
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43873 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts/config/conf.c')
-rw-r--r-- | scripts/config/conf.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/config/conf.c b/scripts/config/conf.c index b769654a89..16e5c43787 100644 --- a/scripts/config/conf.c +++ b/scripts/config/conf.c @@ -13,6 +13,7 @@ #include <getopt.h> #include <sys/stat.h> #include <sys/time.h> +#include <errno.h> #include "lkc.h" @@ -514,14 +515,24 @@ int main(int ac, char **av) { struct timeval now; unsigned int seed; + char *seed_env; /* * Use microseconds derived seed, * compensate for systems where it may be zero */ gettimeofday(&now, NULL); - seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); + + seed_env = getenv("KCONFIG_SEED"); + if( seed_env && *seed_env ) { + char *endp; + int tmp = (int)strtol(seed_env, &endp, 0); + if (*endp == '\0') { + seed = tmp; + } + } + fprintf( stderr, "KCONFIG_SEED=0x%X\n", seed ); srand(seed); break; } @@ -622,7 +633,8 @@ int main(int ac, char **av) conf_set_all_new_symbols(def_default); break; case randconfig: - conf_set_all_new_symbols(def_random); + /* Really nothing to do in this loop */ + while (conf_set_all_new_symbols(def_random)) ; break; case defconfig: conf_set_all_new_symbols(def_default); @@ -664,7 +676,7 @@ int main(int ac, char **av) } else if (input_mode == savedefconfig) { if (conf_write_defconfig(defconfig_file)) { fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"), - defconfig_file); + defconfig_file); return 1; } } else if (input_mode != listnewconfig) { |