Skip to content

Commit eefabe2

Browse files
committed
fix(zephyr): explicit cases handling with single return point
1 parent 1e98749 commit eefabe2

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

core/shared/platform/common/posix/posix_sleep.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,28 @@ __wasi_errno_t
2828
os_nanosleep(const os_timespec *req, os_timespec *rem)
2929
{
3030
int ret = 0;
31+
__wasi_errno_t wasi_ret = __WASI_ESUCCESS;
3132

3233
ret = nanosleep(req, rem);
3334

3435
switch(ret)
3536
{
36-
case 14 /* EFAULT */: return __WASI_EFAULT;
37-
case 4 /* EINTR */: return __WASI_EFAULT;
38-
case 22 /* EINVAL */: return __WASI_EINVAL;
39-
case 0: return __WASI_ESUCCESS;
37+
case 14 /* EFAULT */:
38+
{
39+
wasi_ret = __WASI_EFAULT;
40+
break;
41+
}
42+
case 4 /* EINTR */:
43+
{
44+
wasi_ret = __WASI_EFAULT;
45+
break;
46+
}
47+
case 22 /* EINVAL */:
48+
{
49+
wasi_ret = __WASI_EINVAL;
50+
break;
51+
}
4052
}
53+
54+
return wasi_ret;
4155
}

0 commit comments

Comments
 (0)