about summary refs log tree commit diff
path: root/inet
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-04-26 20:12:37 +0000
committerUlrich Drepper <drepper@redhat.com>2009-04-26 20:12:37 +0000
commit6cc8844f1dd985360f662e78ff2272039025635f (patch)
tree6ebb2abaf95bc129ee800558415fdcfac72642ce /inet
parent5efe86507d871acd6f52d8d25ee437b7394ac6d5 (diff)
downloadglibc-6cc8844f1dd985360f662e78ff2272039025635f.tar.gz
glibc-6cc8844f1dd985360f662e78ff2272039025635f.tar.xz
glibc-6cc8844f1dd985360f662e78ff2272039025635f.zip
* sysdeps/unix/sysv/linux/dl-osinfo.h (dl_fatal): Remove inline
	from definition.

	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Don't define
	label if it is not used.

	* elf/dl-profile.c (_dl_start_profile): Define real-type variant
	of gmon_hist_hdr and gmon_hdr structures and use them.

	* elf/dl-load.c (open_verify): Add temporary variable to avoid
	warning.

	* nscd/nscd_helper.c (get_mapping): Avoid casts to avoid warnings.

	* sunrpc/clnt_raw.c (clntraw_private_s): Use union in definition
	to avoid cast.

	* inet/rexec.c (rexec_af): Make sa2 a union to avoid warnings.
	* inet/rcmd.c (rcmd_af): Make from a union of the various needed types
	to avoid warnings.
	(iruserok_af): Use ss_family instead of casts.

	* gmon/gmon.c (write_hist): Define real-type variant of
	gmon_hist_hdr structure and use it.
	(write_gmon): Likewise for gmon_hdr.

	* sysdeps/unix/sysv/linux/readv.c: Avoid declaration of replacement
	function if we are not going to define it.
	* sysdeps/unix/sysv/linux/writev.c: Likewise.

	* inet/inet6_option.c (optin_alloc): Add temporary variable to
	avoid warning.

	* libio/strfile.h (struct _IO_streambuf): Use correct type and
	name of VTable element.
	* libio/iovsprintf.c: Avoid casts to avoid warnings.
	* libio/iovsscanf.c: Likewise.
	* libio/vasprintf.c: Likewise.
	* libio/vsnprintf.c: Likewise.
	* stdio-common/isoc99_vsscanf.c: Likewise.
	* stdlib/strfmon_l.c: Likewise.
	* debug/vasprintf_chk.c: Likewise.
	* debug/vsnprintf_chk.c: Likewise.
	* debug/vsprintf_chk.c: Likewise.
Diffstat (limited to 'inet')
-rw-r--r--inet/rcmd.c21
-rw-r--r--inet/rexec.c13
2 files changed, 22 insertions, 12 deletions
diff --git a/inet/rcmd.c b/inet/rcmd.c
index 5dcbd25568..343e0954db 100644
--- a/inet/rcmd.c
+++ b/inet/rcmd.c
@@ -112,7 +112,13 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
 {
 	char paddr[INET6_ADDRSTRLEN];
 	struct addrinfo hints, *res, *ai;
-	struct sockaddr_storage from;
+	union
+	{
+	  struct sockaddr sa;
+	  struct sockaddr_storage ss;
+	  struct sockaddr_in sin;
+	  struct sockaddr_in6 sin6;
+	} from;
 	struct pollfd pfd[2];
 	int32_t oldmask;
 	pid_t pid;
@@ -274,14 +280,13 @@ poll: protocol failure in circuit setup\n")) >= 0))
 			(void)__close(s2);
 			goto bad;
 		}
-		s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
-						&len));
-		switch (from.ss_family) {
+		s3 = TEMP_FAILURE_RETRY (accept(s2, &from.sa, &len));
+		switch (from.sa.sa_family) {
 		case AF_INET:
-			rport = ntohs(((struct sockaddr_in *)&from)->sin_port);
+			rport = ntohs(from.sin.sin_port);
 			break;
 		case AF_INET6:
-			rport = ntohs(((struct sockaddr_in6 *)&from)->sin6_port);
+			rport = ntohs(from.sin6.sin6_port);
 			break;
 		default:
 			rport = 0;
@@ -605,13 +610,13 @@ iruserok_af (raddr, superuser, ruser, luser, af)
   memset (&ra, '\0', sizeof(ra));
   switch (af){
   case AF_INET:
-    ((struct sockaddr_in *)&ra)->sin_family = AF_INET;
+    ra.ss_family = AF_INET;
     memcpy (&(((struct sockaddr_in *)&ra)->sin_addr), raddr,
 	    sizeof(struct in_addr));
     ralen = sizeof(struct sockaddr_in);
     break;
   case AF_INET6:
-    ((struct sockaddr_in6 *)&ra)->sin6_family = AF_INET6;
+    ra.ss_family = AF_INET6;
     memcpy (&(((struct sockaddr_in6 *)&ra)->sin6_addr), raddr,
             sizeof(struct in6_addr));
     ralen = sizeof(struct sockaddr_in6);
diff --git a/inet/rexec.c b/inet/rexec.c
index 07ddeeafea..75bb47082b 100644
--- a/inet/rexec.c
+++ b/inet/rexec.c
@@ -56,7 +56,7 @@ rexec_af(ahost, rport, name, pass, cmd, fd2p, af)
 	int *fd2p;
 	sa_family_t af;
 {
-	struct sockaddr_storage sa2, from;
+	struct sockaddr_storage from;
 	struct addrinfo hints, *res0;
 	const char *orig_name = name;
 	const char *orig_pass = pass;
@@ -115,6 +115,11 @@ retry:
 	} else {
 		char num[32];
 		int s2;
+		union
+		{
+		  struct sockaddr_storage ss;
+		  struct sockaddr sa;
+		} sa2;
 		socklen_t sa2len;
 
 		s2 = __socket(res0->ai_family, res0->ai_socktype, 0);
@@ -124,17 +129,17 @@ retry:
 		}
 		__listen(s2, 1);
 		sa2len = sizeof (sa2);
-		if (__getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) {
+		if (__getsockname(s2, &sa2.sa, &sa2len) < 0) {
 			perror("getsockname");
 			(void) __close(s2);
 			goto bad;
-		} else if (sa2len != SA_LEN((struct sockaddr *)&sa2)) {
+		} else if (sa2len != SA_LEN(&sa2.sa)) {
 			__set_errno(EINVAL);
 			(void) __close(s2);
 			goto bad;
 		}
 		port = 0;
-		if (!getnameinfo((struct sockaddr *)&sa2, sa2len,
+		if (!getnameinfo(&sa2.sa, sa2len,
 				 NULL, 0, servbuff, sizeof(servbuff),
 				 NI_NUMERICSERV))
 			port = atoi(servbuff);