Spotted while testing under FreeBSD, needs stdio for snprintf

which expects a non const pointer.
This commit is contained in:
David Carlier 2018-07-19 10:58:38 +00:00
parent 641fa9e960
commit 594b6bff81
1 changed files with 2 additions and 1 deletions

3
vm.c
View File

@ -12,6 +12,7 @@
*/ */
/* $SymiscID: vm.c v1.4 FreeBSD 2012-09-10 00:06 stable <chm@symisc.net> $ */ /* $SymiscID: vm.c v1.4 FreeBSD 2012-09-10 00:06 stable <chm@symisc.net> $ */
#include "ph7int.h" #include "ph7int.h"
#include <stdio.h>
/* /*
* The code in this file implements execution method of the PH7 Virtual Machine. * The code in this file implements execution method of the PH7 Virtual Machine.
* The PH7 compiler (implemented in 'compiler.c' and 'parse.c') generates a bytecode program * The PH7 compiler (implemented in 'compiler.c' and 'parse.c') generates a bytecode program
@ -10770,7 +10771,7 @@ static int vm_builtin_import(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Zero the module entry */ /* Zero the module entry */
SyZero(&pModule, sizeof(VmModule)); SyZero(&pModule, sizeof(VmModule));
SyStringInitFromBuf(&pModule.sName, zStr, nLen); SyStringInitFromBuf(&pModule.sName, zStr, nLen);
const unsigned char *file; unsigned char *file;
snprintf(file, 255, "./%s.lib", zStr); snprintf(file, 255, "./%s.lib", zStr);
SyStringInitFromBuf(&pModule.sFile, file, nLen); SyStringInitFromBuf(&pModule.sFile, file, nLen);
pModule.pHandle = dlopen(pModule.sFile.zString, RTLD_LAZY); pModule.pHandle = dlopen(pModule.sFile.zString, RTLD_LAZY);