m68k/nios2-semi: fix gettimeofday() result check

gettimeofday() returns 0 for success.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Marc-André Lureau 2022-03-04 17:27:00 +04:00
parent 3d76c3b6d8
commit 8ef2513d87
2 changed files with 2 additions and 2 deletions

View File

@ -381,7 +381,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
qemu_timeval tv;
struct gdb_timeval *p;
result = qemu_gettimeofday(&tv);
if (result != 0) {
if (result == 0) {
if (!(p = lock_user(VERIFY_WRITE,
arg0, sizeof(struct gdb_timeval), 0))) {
/* FIXME - check error code? */

View File

@ -403,7 +403,7 @@ void do_nios2_semihosting(CPUNios2State *env)
qemu_timeval tv;
struct gdb_timeval *p;
result = qemu_gettimeofday(&tv);
if (result != 0) {
if (result == 0) {
p = lock_user(VERIFY_WRITE, arg0, sizeof(struct gdb_timeval),
0);
if (!p) {