svn commit: samba r16764 - in trunk/source/lib: .

vlendec at samba.org vlendec at samba.org
Sun Jul 2 21:49:42 GMT 2006


Author: vlendec
Date: 2006-07-02 21:49:42 +0000 (Sun, 02 Jul 2006)
New Revision: 16764

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16764

Log:
One Solaris and two c++compat warnings
Modified:
   trunk/source/lib/socket_wrapper.c


Changeset:
Modified: trunk/source/lib/socket_wrapper.c
===================================================================
--- trunk/source/lib/socket_wrapper.c	2006-07-02 21:27:21 UTC (rev 16763)
+++ trunk/source/lib/socket_wrapper.c	2006-07-02 21:49:42 UTC (rev 16764)
@@ -411,12 +411,16 @@
 		return real_socket(domain, type, protocol);
 	}
 	
+	si = (struct socket_info *)calloc(1, sizeof(struct socket_info));
+	if (si == NULL) {
+		errno = ENOMEM;
+		return -1;
+	}
+
 	fd = real_socket(AF_UNIX, type, 0);
 
 	if (fd == -1) return -1;
 
-	si = calloc(1, sizeof(struct socket_info));
-
 	si->domain = domain;
 	si->type = type;
 	si->protocol = protocol;
@@ -457,7 +461,12 @@
 				       parent_si->domain, addr, addrlen);
 	if (ret == -1) return ret;
 
-	child_si = malloc(sizeof(struct socket_info));
+	child_si = (struct socket_info *)malloc(sizeof(struct socket_info));
+	if (child_si == NULL) {
+		close(fd);
+		errno = ENOMEM;
+		return -1;
+	}
 	memset(child_si, 0, sizeof(*child_si));
 
 	child_si->fd = fd;
@@ -466,7 +475,7 @@
 	child_si->protocol = parent_si->protocol;
 	child_si->bound = 1;
 
-	ret = real_getsockname(fd, &un_my_addr, &un_my_addrlen);
+	ret = real_getsockname(fd, (struct sockaddr *)&un_my_addr, &un_my_addrlen);
 	if (ret == -1) return ret;
 
 	ret = sockaddr_convert_from_un(child_si, &un_my_addr, un_my_addrlen,



More information about the samba-cvs mailing list