diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-10-22 11:32:20 -0400 |
---|---|---|
committer | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-10-22 11:32:20 -0400 |
commit | d46e823381f3497ff892c490a8f9e2b18ceb6cea (patch) | |
tree | 28a1b1462389623efc5a5eb0692d251b3f4dd577 /lib | |
parent | d3a7c72e561aac80022b3e6946079e2a6d757c1f (diff) | |
download | libvfio-user-d46e823381f3497ff892c490a8f9e2b18ceb6cea.zip libvfio-user-d46e823381f3497ff892c490a8f9e2b18ceb6cea.tar.gz libvfio-user-d46e823381f3497ff892c490a8f9e2b18ceb6cea.tar.bz2 |
simplify copying file descriptors
Signed-off-by: Changpeng Liu changpeng.liu@intel.com
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libmuser.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libmuser.c b/lib/libmuser.c index 97384cc..939eb3d 100644 --- a/lib/libmuser.c +++ b/lib/libmuser.c @@ -553,12 +553,9 @@ get_request_sock(lm_ctx_t *lm_ctx, struct vfio_user_header *hdr, if (size % sizeof(int) != 0) { return -EINVAL; } - int i; *nr_fds = (int)(size / sizeof(int)); - for (i = 0; i < *nr_fds; i++) { - //memcpy(fds[i], CMSG_DATA(cmsg) + sizeof(int) * i, sizeof *fds); - fds[i] = *(CMSG_DATA(cmsg) + sizeof(int) * i); - } + memcpy(fds, CMSG_DATA(cmsg), *nr_fds * sizeof(int)); + break; } return ret; |