diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-05-28 21:35:23 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-05-28 21:35:23 +0000 |
commit | 2b8bdefc3a35473e1d43c22e6201aad900dccad2 (patch) | |
tree | 1553b847c5deb9b2fa5e1a62ef850ab0b2961eab /linux-user/syscall_defs.h | |
parent | 7b717336e2873fd6d9f178a12549eaa2367d14d0 (diff) |
Sync __target_cmsg_nxthdr implementation with kernel header.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2894 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user/syscall_defs.h')
-rw-r--r-- | linux-user/syscall_defs.h | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 88f7a217b1..a6129d89bd 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -176,19 +176,14 @@ struct target_cmsghdr { static __inline__ struct target_cmsghdr * __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg) { - if (tswapl(__cmsg->cmsg_len) < sizeof (struct target_cmsghdr)) - /* The kernel header does this so there may be a reason. */ - return 0; - - __cmsg = (struct target_cmsghdr *) ((unsigned char *) __cmsg - + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len))); - if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) (unsigned long)tswapl(__mhdr->msg_control) - + tswapl(__mhdr->msg_controllen)) - || ((unsigned char *) __cmsg + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len)) - > ((unsigned char *) (unsigned long) tswapl(__mhdr->msg_control) - + tswapl(__mhdr->msg_controllen)))) + struct target_cmsghdr *__ptr; + + __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg + + TARGET_CMSG_ALIGN (tswapl(__cmsg->cmsg_len))); + if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapl(__mhdr->msg_control)) + > tswapl(__mhdr->msg_controllen)) /* No more entries. */ - return 0; + return (struct target_cmsghdr *)0; return __cmsg; } |