mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
scm: Return sensible error codes in recv_fds()
Replace "-1" return with errno codes. ENOMSG and EBADFD were choosen to do not cross with standard recvmsg() errors (described in its man page). This patch is need as preparation to making recv_msg() be able to be non-block, and return EAGAIN and EWOULDBLOCK in case of no data. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
25d59cb2bf
commit
6a3cfcd550
2 changed files with 4 additions and 2 deletions
|
|
@ -90,7 +90,7 @@ int recv_fds(int sock, int *fds, int nr_fds, void *data, unsigned ch_size)
|
|||
|
||||
ret = __sys(recvmsg)(sock, &fdset.hdr, 0);
|
||||
if (ret <= 0)
|
||||
return ret ? : -1;
|
||||
return ret ? __sys_err(ret) : -ENOMSG;
|
||||
|
||||
cmsg = CMSG_FIRSTHDR(&fdset.hdr);
|
||||
if (!cmsg || cmsg->cmsg_type != SCM_RIGHTS)
|
||||
|
|
@ -111,7 +111,7 @@ int recv_fds(int sock, int *fds, int nr_fds, void *data, unsigned ch_size)
|
|||
BUG_ON(min_fd > CR_SCM_MAX_FD);
|
||||
|
||||
if (unlikely(min_fd <= 0))
|
||||
return -1;
|
||||
return -EBADFD;
|
||||
|
||||
__memcpy(&fds[i], cmsg_data, sizeof(int) * min_fd);
|
||||
if (data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue