about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-09-28 23:58:33 +0000
committerUlrich Drepper <drepper@redhat.com>1998-09-28 23:58:33 +0000
commit6ff5bc683740fb47bf573c670db71d1796f008ad (patch)
tree2bb24e10a14d530f90ba390131200c738d927b44 /sysdeps
parente07a51b539aee5663361a60f6b3f7a5a75df52d5 (diff)
downloadglibc-6ff5bc683740fb47bf573c670db71d1796f008ad.tar.gz
glibc-6ff5bc683740fb47bf573c670db71d1796f008ad.tar.xz
glibc-6ff5bc683740fb47bf573c670db71d1796f008ad.zip
Update.
1998-09-28 23:55  Ulrich Drepper  <drepper@cygnus.com>

	* nis/ypclnt.c (__yp_bind): Pretty print.  Optimize readv result
	check a bit.  Also close socket of domain client.  Close socket
	in IPPORT_RESERVED error case.

1998-09-28  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/bits/socket.h (__cmsg_nxthdr): Use
	CMSG_ALIGN (fixes a bug) and correct test for availability of
	another entry.
	* sysdeps/unix/sysv/linux/mips/bits/socket.h: Sync with generic
	Linux version.
	(__cmsg_nxthdr): Use CMSG_ALIGN (fixes a bug) and correct test for
	availability of another entry.
	Patch by ak@muc.de.

	* sysdeps/unix/sysv/linux/netinet/ip.h (IPOPT_NOOP): Fix typo.
	Patch by ak@muc.de.

1998-09-27  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* posix/annexc.c (xsystem): New function.  Use it instead of
	system.

1998-09-28  Ulrich Drepper  <drepper@cygnus.com>

	* stdlib/longlong.h: Remove #endif for #if removed in last change.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h13
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/socket.h20
-rw-r--r--sysdeps/unix/sysv/linux/netinet/ip.h2
3 files changed, 21 insertions, 14 deletions
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 226e332043..a11c22db72 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -204,18 +204,19 @@ extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr,
 _EXTERN_INLINE struct cmsghdr *
 __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
 {
-  unsigned char *__p;
-
   if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
     /* The kernel header does this so there may be a reason.  */
     return NULL;
 
-  __p = (((unsigned char *) __cmsg)
-	 + ((__cmsg->cmsg_len + sizeof (long int) - 1) & ~sizeof (long int)));
-  if (__p >= (unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)
+  __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+			       + CMSG_ALIGN (__cmsg->cmsg_len));
+  if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
+					 + __mhdr->msg_controllen)
+      || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
+	  >= ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
     /* No more entries.  */
     return NULL;
-  return (struct cmsghdr *) __p;
+  return __cmsg;
 }
 
 /* Socket level message types.  This must match the definitions in
diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket.h b/sysdeps/unix/sysv/linux/mips/bits/socket.h
index 75ed54fc56..528b8be8d4 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/socket.h
@@ -149,8 +149,13 @@ struct cmsghdr
 #endif
 #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
 #define CMSG_FIRSTHDR(mhdr) \
-  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)			      \
+  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)		      \
    ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
+			 & ~(sizeof (size_t) - 1))
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
+			 + CMSG_ALIGN (sizeof (struct cmsghdr)))
+#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
 
 
 #ifndef _EXTERN_INLINE
@@ -161,18 +166,19 @@ extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr,
 _EXTERN_INLINE struct cmsghdr *
 __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
 {
-  unsigned char *__p;
-
   if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
     /* The kernel header does this so there may be a reason.  */
     return NULL;
 
-  __p = (((unsigned char *) __cmsg)
-	 + ((__cmsg->cmsg_len + sizeof (long int) - 1) & ~sizeof (long int)));
-  if (__p >= (unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)
+  __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+			       + CMSG_ALIGN (__cmsg->cmsg_len));
+  if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control
+					 + __mhdr->msg_controllen)
+      || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
+	  >= ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
     /* No more entries.  */
     return NULL;
-  return (struct cmsghdr *) __p;
+  return __cmsg;
 }
 
 
diff --git a/sysdeps/unix/sysv/linux/netinet/ip.h b/sysdeps/unix/sysv/linux/netinet/ip.h
index 1add1b2b59..246a56a5de 100644
--- a/sysdeps/unix/sysv/linux/netinet/ip.h
+++ b/sysdeps/unix/sysv/linux/netinet/ip.h
@@ -224,7 +224,7 @@ struct ip_timestamp
 #define	IPOPT_EOL		0		/* end of option list */
 #define	IPOPT_END		IPOPT_EOL
 #define	IPOPT_NOP		1		/* no operation */
-#define	IPOPT_NOOP		IP_NOP
+#define	IPOPT_NOOP		IPOPT_NOP
 
 #define	IPOPT_RR		7		/* record packet route */
 #define	IPOPT_TS		68		/* timestamp */