Józef Kucia joseph.kucia@gmail.com wrote:
+bool vkd3d_get_program_name(char program_name[PATH_MAX]) +{
- strncpy(program_name, getprogname(), PATH_MAX);
- program_name[PATH_MAX - 1] = '\0';
strncpy() always adds a terminating null byte.
It doesn not in case of insufficient target buffer size. That's probably not the common case though, however strncpy() always fills up the buffer with zeros which is worst behaviour ever, so it's probably better to just use plain strcpy().