Mercurial > dwindows
comparison gtk/dw.c @ 2210:7677e1083d07
Increase _DW_ENV_STRING_SIZE to 257 bytes, this is the maximum size the
utsname fields can be according to the Linux utsname man page.
This seems to be a bit excessive but, this will prevent any possible issue
on future operating system support. It also eliminates a bogus warning when
compiling using gcc 9 and higher, which I believe is this gcc bug:
warning: ‘__builtin_strncpy’ output may be truncated copying 64 bytes from a string of length 64 [-Wstringop-truncation]
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88780
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 07 Dec 2020 20:01:03 +0000 |
parents | 0b6e1b5c8b5e |
children | 9395c1efa98b |
comparison
equal
deleted
inserted
replaced
2209:0b6e1b5c8b5e | 2210:7677e1083d07 |
---|---|
12515 * env: Pointer to a DWEnv struct. | 12515 * env: Pointer to a DWEnv struct. |
12516 */ | 12516 */ |
12517 void dw_environment_query(DWEnv *env) | 12517 void dw_environment_query(DWEnv *env) |
12518 { | 12518 { |
12519 struct utsname name; | 12519 struct utsname name; |
12520 char tempbuf[100] = { 0 }, *dot; | 12520 char tempbuf[_DW_ENV_STRING_SIZE] = { 0 }, *dot; |
12521 | 12521 |
12522 uname(&name); | 12522 uname(&name); |
12523 memset(env, '\0', sizeof(DWEnv)); | 12523 memset(env, '\0', sizeof(DWEnv)); |
12524 strncpy(env->osName, name.sysname, sizeof(env->osName)-1); | 12524 strncpy(env->osName, name.sysname, sizeof(env->osName)-1); |
12525 strncpy(tempbuf, name.release, 99); | 12525 strncpy(tempbuf, name.release, sizeof(tempbuf)-1); |
12526 | 12526 |
12527 strncpy(env->buildDate, __DATE__, sizeof(env->buildDate)-1); | 12527 strncpy(env->buildDate, __DATE__, sizeof(env->buildDate)-1); |
12528 strncpy(env->buildTime, __TIME__, sizeof(env->buildTime)-1); | 12528 strncpy(env->buildTime, __TIME__, sizeof(env->buildTime)-1); |
12529 env->DWMajorVersion = DW_MAJOR_VERSION; | 12529 env->DWMajorVersion = DW_MAJOR_VERSION; |
12530 env->DWMinorVersion = DW_MINOR_VERSION; | 12530 env->DWMinorVersion = DW_MINOR_VERSION; |