From: <ped...@us...> - 2007-09-02 17:59:20
|
Revision: 1051 http://cegcc.svn.sourceforge.net/cegcc/?rev=1051&view=rev Author: pedroalves Date: 2007-09-02 10:59:12 -0700 (Sun, 02 Sep 2007) Log Message: ----------- Fix dumm bug. Writting to a pipe from a ro buffer, eg: write (pipe, "", 1) ... would fail, because of the reverse IsBadWritePtr/IsBadReadPtr usage. * PipeLib.cpp (Read): Switch to IsBadWritePtr. Only set last error to ERROR_BROKEN_PIPE if returning. (Write): Switch to IsBadReadPtr. Modified Paths: -------------- trunk/cegcc/tools/PipeLib/ChangeLog trunk/cegcc/tools/PipeLib/PipeDev.cpp Modified: trunk/cegcc/tools/PipeLib/ChangeLog =================================================================== --- trunk/cegcc/tools/PipeLib/ChangeLog 2007-09-02 17:55:11 UTC (rev 1050) +++ trunk/cegcc/tools/PipeLib/ChangeLog 2007-09-02 17:59:12 UTC (rev 1051) @@ -1,3 +1,9 @@ +2007-09-02 Pedro Alves <ped...@po...> + + * PipeLib.cpp (Read): Switch to IsBadWritePtr. Only set last + error to ERROR_BROKEN_PIPE if returning. + (Write): Switch to IsBadReadPtr. + 2007-07-02 Danny Backx <dan...@us...> Pedro Alves <ped...@po...> Modified: trunk/cegcc/tools/PipeLib/PipeDev.cpp =================================================================== --- trunk/cegcc/tools/PipeLib/PipeDev.cpp 2007-09-02 17:55:11 UTC (rev 1050) +++ trunk/cegcc/tools/PipeLib/PipeDev.cpp 2007-09-02 17:59:12 UTC (rev 1051) @@ -673,7 +673,7 @@ { LOGSCOPE ("\n"); - if (IsBadReadPtr (pBuffer, dwCount)) + if (IsBadWritePtr (pBuffer, dwCount)) { SetLastError (ERROR_INVALID_PARAMETER); LOG ("\n"); @@ -719,7 +719,6 @@ || dev->OpenCount == 0 /* or, ... weird */ ) { - SetLastError (ERROR_BROKEN_PIPE); if (needed - dwCount) { /* I don't know a way to report error and 'valid @@ -729,6 +728,7 @@ break; } LOG ("Pipe broken\n"); + SetLastError (ERROR_BROKEN_PIPE); return (DWORD) -1; } @@ -772,7 +772,7 @@ { LOGSCOPE ("\n"); - if (IsBadWritePtr ((void*) pBuffer, dwCount)) + if (IsBadReadPtr (pBuffer, dwCount)) { SetLastError (ERROR_INVALID_PARAMETER); LOG ("\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |