diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-12-30 19:43:35 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-12-30 19:43:35 +0000 |
commit | 68ffb9a85da9884880eed8ca2dab6ebf6c78729d (patch) | |
tree | cabac94fa14a9e8e14bcf420731edccc59698820 /scripts/kconfig | |
parent | 40ae9b56174513c9e843f7b479bc64e14b2f1b64 (diff) | |
download | busybox-w32-68ffb9a85da9884880eed8ca2dab6ebf6c78729d.tar.gz busybox-w32-68ffb9a85da9884880eed8ca2dab6ebf6c78729d.tar.bz2 busybox-w32-68ffb9a85da9884880eed8ca2dab6ebf6c78729d.zip |
make sure AUTOCONF_TIMESTAMP is filled up properly ... if user has a timezone of Factory for example, strftime() will overflow the string and leave us without a trailing "\n and all hell breaks loose when we compile
Diffstat (limited to 'scripts/kconfig')
-rw-r--r-- | scripts/kconfig/confdata.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index d38bbba93..b4c862a83 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -395,9 +395,18 @@ int conf_write(const char *name) | |||
395 | char buf[sizeof("#define AUTOCONF_TIMESTAMP " | 395 | char buf[sizeof("#define AUTOCONF_TIMESTAMP " |
396 | "\"YYYY-MM-DD HH:MM:SS some_timezone\"\n")]; | 396 | "\"YYYY-MM-DD HH:MM:SS some_timezone\"\n")]; |
397 | buf[0] = '\0'; | 397 | buf[0] = '\0'; |
398 | if (use_timestamp) | 398 | if (use_timestamp) { |
399 | strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP " | 399 | size_t ret = \ |
400 | "\"%Y-%m-%d %H:%M:%S %Z\"\n", localtime(&now)); | 400 | strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP " |
401 | "\"%Y-%m-%d %H:%M:%S %Z\"\n", localtime(&now)); | ||
402 | /* if user has Factory timezone or some other odd install, the | ||
403 | * %Z above will overflow the string leaving us with undefined | ||
404 | * results ... so let's try again without the timezone. | ||
405 | */ | ||
406 | if (ret == 0) | ||
407 | strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP " | ||
408 | "\"%Y-%m-%d %H:%M:%S\"\n", localtime(&now)); | ||
409 | } | ||
401 | fprintf(out_h, "/*\n" | 410 | fprintf(out_h, "/*\n" |
402 | " * Automatically generated C config: don't edit\n" | 411 | " * Automatically generated C config: don't edit\n" |
403 | " * Linux kernel version: %s\n" | 412 | " * Linux kernel version: %s\n" |