Send event if an error occurs in -open

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24422 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2007-01-28 07:15:27 +00:00
parent 094b9191d3
commit 39d5aec7e1
3 changed files with 20 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2007-01-28 Richard Frith-Macdonald <rfm@gnu.org>
* unix/NSStream.m:
* win32/NSStreamWin32.m:
Send event if an error occurs in the -open method.
2007-01-25 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: fix failure to unlock thread lock when

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

@ -326,6 +326,7 @@ static void setNonblocking(SOCKET fd)
if (h == INVALID_HANDLE_VALUE)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
[self _setLoopID: (void*)h];
@ -765,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
@ -1077,6 +1079,7 @@ static void setNonblocking(SOCKET fd)
if (h == INVALID_HANDLE_VALUE)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
else if (_shouldAppend == NO)
@ -1084,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];
@ -1539,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
@ -2231,6 +2236,7 @@ done:
if (bindReturn < 0 || listenReturn < 0)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
setNonblocking(_sock);
@ -2444,6 +2450,7 @@ done:
if (handle == INVALID_HANDLE_VALUE)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
@ -2466,6 +2473,7 @@ done:
else if (errno != ERROR_IO_PENDING)
{
[self _recordError];
[self _sendEvent: NSStreamEventErrorOccurred];
return;
}
}