From dc057115b5068fe6edf209a706a43893a67f3469 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 16 May 2017 19:19:51 +0100 Subject: 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. --- fake-msi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fake-msi.c b/fake-msi.c index 92c24e3..25a43a1 100644 --- a/fake-msi.c +++ b/fake-msi.c @@ -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); -- cgit v1.2.3-55-g6feb