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
This commit is contained in:
parent
40ae9b5617
commit
68ffb9a85d
@ -395,9 +395,18 @@ int conf_write(const char *name)
|
|||||||
char buf[sizeof("#define AUTOCONF_TIMESTAMP "
|
char buf[sizeof("#define AUTOCONF_TIMESTAMP "
|
||||||
"\"YYYY-MM-DD HH:MM:SS some_timezone\"\n")];
|
"\"YYYY-MM-DD HH:MM:SS some_timezone\"\n")];
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
if (use_timestamp)
|
if (use_timestamp) {
|
||||||
|
size_t ret = \
|
||||||
strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP "
|
strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP "
|
||||||
"\"%Y-%m-%d %H:%M:%S %Z\"\n", localtime(&now));
|
"\"%Y-%m-%d %H:%M:%S %Z\"\n", localtime(&now));
|
||||||
|
/* if user has Factory timezone or some other odd install, the
|
||||||
|
* %Z above will overflow the string leaving us with undefined
|
||||||
|
* results ... so let's try again without the timezone.
|
||||||
|
*/
|
||||||
|
if (ret == 0)
|
||||||
|
strftime(buf, sizeof(buf), "#define AUTOCONF_TIMESTAMP "
|
||||||
|
"\"%Y-%m-%d %H:%M:%S\"\n", localtime(&now));
|
||||||
|
}
|
||||||
fprintf(out_h, "/*\n"
|
fprintf(out_h, "/*\n"
|
||||||
" * Automatically generated C config: don't edit\n"
|
" * Automatically generated C config: don't edit\n"
|
||||||
" * Linux kernel version: %s\n"
|
" * Linux kernel version: %s\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user