diff options
Diffstat (limited to 'extra/config/conf.c')
-rw-r--r-- | extra/config/conf.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/extra/config/conf.c b/extra/config/conf.c index 02b2600c2..d623ed1d3 100644 --- a/extra/config/conf.c +++ b/extra/config/conf.c @@ -11,6 +11,7 @@ #include <time.h> #include <unistd.h> #include <sys/stat.h> +#include <sys/time.h> #define LKC_DIRECT_LINK #include "lkc.h" @@ -432,6 +433,7 @@ int main(int ac, char **av) { int opt; const char *name; + const char *configname = conf_get_configname(); struct stat tmpstat; setlocale(LC_ALL, ""); @@ -464,9 +466,22 @@ int main(int ac, char **av) input_mode = set_yes; break; case 'r': + { + struct timeval now; + unsigned int seed; + + /* + * 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)); + srand(seed); + input_mode = set_random; - srand(time(NULL)); break; + } case 'h': printf(_("See README for usage info\n")); exit(0); @@ -484,7 +499,7 @@ int main(int ac, char **av) conf_parse(name); //zconfdump(stdout); if (sync_kconfig) { - if (stat(".config", &tmpstat)) { + if (stat(configname, &tmpstat)) { fprintf(stderr, _("***\n" "*** You have not yet configured!\n" "*** (missing .config file)\n" |