From: <ped...@us...> - 2007-07-02 01:20:57
|
Revision: 1036 http://svn.sourceforge.net/cegcc/?rev=1036&view=rev Author: pedroalves Date: 2007-07-01 18:20:56 -0700 (Sun, 01 Jul 2007) Log Message: ----------- * PipeLib.cpp (CreatePipe): Handle unexpected ActivateDevice failures. Record last error as ERROR_TOO_MANY_OPEN_FILES when there aren't any pipe slots left. Modified Paths: -------------- trunk/cegcc/tools/PipeLib/ChangeLog trunk/cegcc/tools/PipeLib/PipeLib.cpp Modified: trunk/cegcc/tools/PipeLib/ChangeLog =================================================================== --- trunk/cegcc/tools/PipeLib/ChangeLog 2007-07-02 00:54:55 UTC (rev 1035) +++ trunk/cegcc/tools/PipeLib/ChangeLog 2007-07-02 01:20:56 UTC (rev 1036) @@ -1,3 +1,10 @@ +2007-07-02 Pedro Alves <ped...@po...> + Danny Backx <dan...@us...> + + * PipeLib.cpp (CreatePipe): Handle unexpected ActivateDevice + failures. Record last error as ERROR_TOO_MANY_OPEN_FILES when + there aren't any pipe slots left. + 2007-07-01 Pedro Alves <ped...@po...> * PipeDev.cpp (Write): Remove breaknext and its usage. Modified: trunk/cegcc/tools/PipeLib/PipeLib.cpp =================================================================== --- trunk/cegcc/tools/PipeLib/PipeLib.cpp 2007-07-02 00:54:55 UTC (rev 1035) +++ trunk/cegcc/tools/PipeLib/PipeLib.cpp 2007-07-02 01:20:56 UTC (rev 1036) @@ -147,6 +147,13 @@ 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 @@ } 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 was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |