@@ -12092,15 +12092,16 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
{
struct mq_attr posix_mq_attr_in, posix_mq_attr_out;
ret = 0;
- if (arg3 != 0) {
- ret = mq_getattr(arg1, &posix_mq_attr_out);
- copy_to_user_mq_attr(arg3, &posix_mq_attr_out);
- }
if (arg2 != 0) {
copy_from_user_mq_attr(&posix_mq_attr_in, arg2);
- ret |= mq_setattr(arg1, &posix_mq_attr_in, &posix_mq_attr_out);
+ ret = get_errno(mq_setattr(arg1, &posix_mq_attr_in,
+ &posix_mq_attr_out));
+ } else if (arg3 != 0) {
+ ret = get_errno(mq_getattr(arg1, &posix_mq_attr_out));
+ }
+ if (ret == 0 && arg3 != 0) {
+ copy_to_user_mq_attr(arg3, &posix_mq_attr_out);
}
-
}
break;
#endif