Backport fixes from trunk

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/stable@24423 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-01-28 07:27:43 +00:00
parent 145f27c90f
commit 70a9e520e9
4 changed files with 30 additions and 4 deletions

View file

@ -1,3 +1,14 @@
2007-01-28 Richard Frith-Macdonald <rfm@gnu.org>
* Source/unix/NSStream.m:
* Source/win32/NSStreamWin32.m:
Backport fix to send event if error occurs in -open
2007-01-25 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: fix failure to unlock thread lock when
unable to obtain filesystem lock.
2007-01-23 Adam Fedor <fedor@gnu.org>
* Source/NSObject.m ([NSObject +initialize]): Apply BSD FPU fix

View file

@ -1609,6 +1609,7 @@ static BOOL isLocked = NO;
if ([self lockDefaultsFile: &wasLocked] == NO)
{
[_lock unlock];
return NO;
}

View file

@ -360,6 +360,7 @@ static void setNonblocking(int fd)
if (fd < 0)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
_loopID = (void*)(intptr_t)fd;
@ -472,6 +473,7 @@ static void setNonblocking(int fd)
return;
}
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
}
@ -756,9 +758,10 @@ static void setNonblocking(int fd)
else
flag = flag | O_TRUNC;
fd = open([_path fileSystemRepresentation], flag, mode);
if (fd< 0)
if (fd < 0)
{ // make an error
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
_loopID = (void*)(intptr_t)fd;
@ -917,6 +920,7 @@ static void setNonblocking(int fd)
return;
}
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
}
@ -1450,6 +1454,7 @@ static void setNonblocking(int fd)
if (bindReturn < 0 || listenReturn < 0)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
setNonblocking((intptr_t)_loopID);

View file

@ -44,6 +44,7 @@
#include <Foundation/NSDebug.h>
#include "../GSStream.h"
#include "../GSPrivate.h"
#define BUFFERSIZE (BUFSIZ*64)
@ -269,7 +270,7 @@ static void setNonblocking(SOCKET fd)
unsigned long dummy = 1;
if (ioctlsocket(fd, FIONBIO, &dummy) == SOCKET_ERROR)
NSLog(@"unable to set non-blocking mode - %s",GSLastErrorStr(errno));
NSLog(@"unable to set non-blocking mode - %@", GSLastErrorStr(errno));
}
@implementation GSFileInputStream
@ -325,6 +326,7 @@ static void setNonblocking(SOCKET fd)
if (h == INVALID_HANDLE_VALUE)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
[self _setLoopID: (void*)h];
@ -764,6 +766,7 @@ static void setNonblocking(SOCKET fd)
&& WSAGetLastError() != WSAEWOULDBLOCK)
{// make an error
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
// waiting on writable, as an indication of opened
@ -1076,6 +1079,7 @@ static void setNonblocking(SOCKET fd)
if (h == INVALID_HANDLE_VALUE)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
else if (_shouldAppend == NO)
@ -1083,6 +1087,7 @@ static void setNonblocking(SOCKET fd)
if (SetEndOfFile(h) == 0) // Truncate to current file pointer (0)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
}
}
[self _setLoopID: (void*)h];
@ -1538,6 +1543,7 @@ static void setNonblocking(SOCKET fd)
&& WSAGetLastError() != WSAEWOULDBLOCK)
{// make an error
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
// waiting on writable, as an indication of opened
@ -1866,8 +1872,8 @@ static void setNonblocking(SOCKET fd)
if (handle == INVALID_HANDLE_VALUE)
{
[NSException raise: NSInternalInconsistencyException
format: @"Unable to open named pipe '%@'... %s",
path, GSLastErrorStr(GetLastError())];
format: @"Unable to open named pipe '%@'... %@",
path, GSLastErrorStr(errno)];
}
// the type of the stream does not matter, since we are only using the fd
@ -2230,6 +2236,7 @@ done:
if (bindReturn < 0 || listenReturn < 0)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
setNonblocking(_sock);
@ -2443,6 +2450,7 @@ done:
if (handle == INVALID_HANDLE_VALUE)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
@ -2465,6 +2473,7 @@ done:
else if (errno != ERROR_IO_PENDING)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
}