Fixed some potential segfault with wine apps (maybe others too)

This commit is contained in:
ptitSeb 2023-12-01 17:41:03 +01:00
parent ca1f0d0cf2
commit e02844fb93

View File

@ -1774,7 +1774,8 @@ EXPORT int32_t my_open(x86emu_t* emu, void* pathname, int32_t flags, uint32_t mo
int dummy = write(tmp, emu->context->fullpath, strlen(emu->context->fullpath)+1);
(void)dummy;
for (int i=1; i<emu->context->argc; ++i)
dummy = write(tmp, emu->context->argv[i], strlen(emu->context->argv[i])+1);
if(emu->context->argv[i])
dummy = write(tmp, emu->context->argv[i], strlen(emu->context->argv[i])+1);
lseek(tmp, 0, SEEK_SET);
#endif
return tmp;
@ -1862,7 +1863,8 @@ EXPORT int32_t my_open64(x86emu_t* emu, void* pathname, int32_t flags, uint32_t
int dummy = write(tmp, emu->context->fullpath, strlen(emu->context->fullpath)+1);
(void)dummy;
for (int i=1; i<emu->context->argc; ++i)
dummy = write(tmp, emu->context->argv[i], strlen(emu->context->argv[i])+1);
if(emu->context->argv[i]) //can be NULL when wine re-adjust the args
dummy = write(tmp, emu->context->argv[i], strlen(emu->context->argv[i])+1);
lseek(tmp, 0, SEEK_SET);
#endif
return tmp;