preproc: Add found files to the list of dependencies even when cached

This fixes the dependency listings as generated with -MD (if
assembling runs in multiple passes).

https://bugzilla.nasm.us/show_bug.cgi?id=3392420

gorcunov@: add missing zero byte

Signed-off-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
Martin Storsjö 2017-08-13 17:28:46 +03:00 committed by H. Peter Anvin
parent d7a5473368
commit f283c8f5c2

View File

@ -1574,6 +1574,14 @@ static FILE *inc_fopen(const char *file,
hp = hash_find(&FileHash, file, &hi);
if (hp) {
path = *hp;
if (path || omode != INC_NEEDED) {
const char *name = path ? path : file;
size_t name_len = strlen(name);
sl = nasm_malloc(name_len + 1 + sizeof sl->next);
memcpy(sl->str, name, name_len+1);
sl->next = NULL;
nasm_add_to_strlist(dhead, sl);
}
} else {
/* Need to do the actual path search */
size_t file_len;