|
Re: Small example for rshd ?: msg#00011gnu.cegcc.devel
Danny Backx wrote: - Error handling in PipeLib. On my system, ActivateDevice returns with I've committed the attached patch to handle this case. Cheers, Pedro Alves 2007-07-02 Pedro Alves <pedro_alves-BwYwT0D5Mwdz4s462UR3lw@xxxxxxxxxxxxxxxx> Danny Backx <dannybackx-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx> * PipeLib.cpp (CreatePipe): Handle unexpected ActivateDevice failures. Record last error as ERROR_TOO_MANY_OPEN_FILES when there aren't any pipe slots left. Index: PipeLib.cpp =================================================================== --- PipeLib.cpp (revision 1027) +++ PipeLib.cpp (working copy) @@ -147,6 +147,13 @@ CreatePipe (PHANDLE hReadPipe, RegDeleteKey (HKEY_LOCAL_MACHINE, wsKey); free (wsKey); + if (!h && GetLastError() != ERROR_DEVICE_IN_USE) + { + /* Something went wrong. Use GetLastError for extended + information. */ + return FALSE; + } + /* Although MSDN documents the error as INVALID_HANDLE_VALUE, I see it returning NULL here. */ if (h != INVALID_HANDLE_VALUE && h != NULL) @@ -154,7 +161,10 @@ CreatePipe (PHANDLE hReadPipe, } if (inst == MAX_INSTANCES) - return FALSE; + { + SetLastError (ERROR_TOO_MANY_OPEN_FILES); + return FALSE; + } /* name + num + ':' + '\0' */ wchar_t device_name[(sizeof (NAME_BASE) - 1) + 2 + 1 + 1]; ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/_______________________________________________ Cegcc-devel mailing list Cegcc-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/cegcc-devel |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: C++ exceptions: 00011, Pedro Alves |
|---|---|
| Next by Date: | Re: Small example for rshd ?: 00011, Pedro Alves |
| Previous by Thread: | Re: Small example for rshd ?i: 00011, Pedro Alves |
| Next by Thread: | Re: Small example for rshd ?: 00011, Pedro Alves |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |