ObjFW  Check-in [1404d33024]

Overview
Comment:Ignore SIGPIPE when using OFStream.

SIGPIPE is quite useless and contraproductive as we throw an
OFWriteFailedException anyway.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1404d330243c44f2279b1d37aec1eea1ddcf31c5c4589bff6ea3c374e1966380
User & Date: js on 2011-01-08 15:57:35
Other Links: manifest | tags
Context
2011-01-08
15:59
Prefer -[release] over -[dealloc]. check-in: c53575653d user: js tags: trunk
15:57
Ignore SIGPIPE when using OFStream. check-in: 1404d33024 user: js tags: trunk
2011-01-04
22:58
Allow -framework in objfw-compile. check-in: 3cfb6d105e user: js tags: trunk
Changes

Modified src/OFStream.m from [3b625f7cf5] to [f885e71d37].

20
21
22
23
24
25
26




27
28
29
30
31
32
33
34
35
36










37
38
39
40
41
42
43
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <assert.h>
#include <fcntl.h>





#import "OFStream.h"
#import "OFString.h"
#import "OFDataArray.h"
#import "OFExceptions.h"
#import "macros.h"

#import "asprintf.h"

@implementation OFStream










- init
{
	if (isa == [OFStream class]) {
		Class c = isa;
		[self release];
		@throw [OFNotImplementedException newWithClass: c
						      selector: _cmd];







>
>
>
>










>
>
>
>
>
>
>
>
>
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <assert.h>
#include <fcntl.h>

#ifndef _WIN32
# include <signal.h>
#endif

#import "OFStream.h"
#import "OFString.h"
#import "OFDataArray.h"
#import "OFExceptions.h"
#import "macros.h"

#import "asprintf.h"

@implementation OFStream
#ifndef _WIN32
+ (void)initialize
{
	if (self != [OFStream class])
		return;

	signal(SIGPIPE, SIG_IGN);
}
#endif

- init
{
	if (isa == [OFStream class]) {
		Class c = isa;
		[self release];
		@throw [OFNotImplementedException newWithClass: c
						      selector: _cmd];

Modified src/OFTCPSocket.m from [5bed299304] to [94deb56f45].

348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367

	newsock = [[[isa alloc] init] autorelease];
	addrlen = sizeof(struct sockaddr);

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

	if ((s = accept(sock, addr, &addrlen)) == INVALID_SOCKET) {
		[newsock dealloc];
		@throw [OFAcceptFailedException newWithClass: isa];
	}

	newsock->sock = s;
	newsock->sockAddr = addr;
	newsock->sockAddrLen = addrlen;








|




|







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367

	newsock = [[[isa alloc] init] autorelease];
	addrlen = sizeof(struct sockaddr);

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

	if ((s = accept(sock, addr, &addrlen)) == INVALID_SOCKET) {
		[newsock release];
		@throw [OFAcceptFailedException newWithClass: isa];
	}

	newsock->sock = s;
	newsock->sockAddr = addr;
	newsock->sockAddrLen = addrlen;