Write terminating strings when MsiGetFileVersion() fails.

I had expected that if you were returning a failure code you didn't
have to - perhaps even _shouldn't_ - write through the output pointer
arguments. But in fact, now that my implementation of
MsiGetFileVersion _knows_ how to fail (i.e. doesn't just return a
hardcoded value for every call), the MSI build doesn't work unless I
also clear the output strings in the case of failure.
This commit is contained in:
Simon Tatham 2017-05-16 19:19:51 +01:00
parent 74592eecf3
commit dc057115b5

View file

@ -25,6 +25,11 @@ uint32_t MsiGetFileVersionW(const char16_t *filename,
int fd = -1;
void *mapv = MAP_FAILED;
if (version && *version_size)
*version = 0;
if (language && *language_size)
*language = 0;
fd = open(fname, O_RDONLY);
if (fd < 0)
err(1, "%s: open", fname);