On Wed, Aug 31, 2022 at 8:59 PM Marc-André Lureau <marcandre.lur...@gmail.com> wrote: > > Hi > > On Wed, Aug 24, 2022 at 1:54 PM Bin Meng <bmeng...@gmail.com> wrote: >> >> From: Bin Meng <bin.m...@windriver.com> >> >> Use g_get_tmp_dir() to get the directory to use for temporary files. >> >> Signed-off-by: Bin Meng <bin.m...@windriver.com> >> --- >> >> semihosting/arm-compat-semi.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c >> index e741674238..d5e66cc298 100644 >> --- a/semihosting/arm-compat-semi.c >> +++ b/semihosting/arm-compat-semi.c >> @@ -503,7 +503,8 @@ void do_common_semihosting(CPUState *cs) >> GET_ARG(0); >> GET_ARG(1); >> GET_ARG(2); >> - len = asprintf(&s, "/tmp/qemu-%x%02x", getpid(), (int)arg1 & 0xff); >> + len = asprintf(&s, "%s/qemu-%x%02x", g_get_tmp_dir(), >> + getpid(), (int)arg1 & 0xff); > > > This is most likely wrong. I am not familiar with semihosting, but I believe > we are implementing tmpnam(), it should return a POSIX filename.
Replacing /tmp with g_get_tmp_dir() is not wrong, correct? I checked the semihosting spec, it does not mention the file name should be a POSIX compliant path. https://developer.arm.com/documentation/dui0058/d/semihosting/semihosting-swis/sys-tmpnam--0x0d- Certainly this needs a semihosting expert to take a look. > >> >> if (len < 0) { >> common_semi_set_ret(cs, -1); >> break; >> -- Regards, Bin