ObjFW  Check-in [c9f2fe558e]

Overview
Comment:Allocate space for sockaddr_storage, not sockaddr.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c9f2fe558e1203a3faa6c414d4c6daae35ec057e015de4dee53e3c2d6a74058e
User & Date: js on 2012-10-22 20:12:24
Other Links: manifest | tags
Context
2012-10-23
09:17
configure.ac: Show a note about old compilers. check-in: 8321c1a567 user: js tags: trunk
2012-10-22
20:12
Allocate space for sockaddr_storage, not sockaddr. check-in: c9f2fe558e user: js tags: trunk
20:11
PLATFORMS.md: Add DragonFlyBSD. check-in: c2d05e0469 user: js tags: trunk
Changes

Modified src/OFTCPSocket.m from [29f21ecbe7] to [da12c47fdd].

622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
{
	OFTCPSocket *newSocket;
	struct sockaddr_storage *addr;
	socklen_t addrLen;
	int newSock;

	newSocket = [[[[self class] alloc] init] autorelease];
	addrLen = sizeof(struct sockaddr);

	@try {
		addr = [newSocket allocMemoryWithSize: sizeof(struct sockaddr)];
	} @catch (id e) {
		[newSocket release];
		@throw e;
	}

	if ((newSock = accept(sock, (struct sockaddr*)addr,
	    &addrLen)) == INVALID_SOCKET) {







|


|







622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
{
	OFTCPSocket *newSocket;
	struct sockaddr_storage *addr;
	socklen_t addrLen;
	int newSock;

	newSocket = [[[[self class] alloc] init] autorelease];
	addrLen = sizeof(*addr);

	@try {
		addr = [newSocket allocMemoryWithSize: addrLen];
	} @catch (id e) {
		[newSocket release];
		@throw e;
	}

	if ((newSock = accept(sock, (struct sockaddr*)addr,
	    &addrLen)) == INVALID_SOCKET) {