[PATCH vkd3d] vkd3d: Add vkd3d_get_program_name() implementation for macOS.

Dmitry Timoshkov dmitry at baikal.ru
Thu Aug 1 02:43:09 CDT 2019


Józef Kucia <joseph.kucia at 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().

-- 
Dmitry.



More information about the wine-devel mailing list