This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

AW: probably simple problem: ASSERT in Cyg_StdIostream


Because this are Stdio buffers constructed on startup we can abort, if memory allocation fails:

Index: packages/language/c/libc/stdio/current/include/streambuf.inl
===================================================================
RCS file: /cvs/ecos/ecos/packages/language/c/libc/stdio/current/include/streambuf.inl,v


retrieving revision 1.6
diff -u -r1.6 streambuf.inl
--- packages/language/c/libc/stdio/current/include/streambuf.inl 23 May 2002 23:07:16 -0000 1.6
+++ packages/language/c/libc/stdio/current/include/streambuf.inl 25 Apr 2006 08:41:32 -0000
@@ -92,7 +92,8 @@
// unnecessary, but it is to ensure a defined state if e.g. the malloc
// in set_buffer() should fail


-    (void)set_buffer(size, new_buffer);
+       Cyg_ErrNo err = set_buffer(size, new_buffer);
+       CYG_ASSERT(err == ENOERR, "insufficient memory");
} // Cyg_StdioStreamBuffer constructor

Andrew Lunn wrote:
On Tue, Apr 25, 2006 at 07:43:16AM +0200, Manfred W?lfel wrote:
In the case of buffered IO, the constructor of Cyg_StdioStream constructs a Cyg_StdioStreamBuffer object io_buf. The constructor of Cyg_StdioStreamBuffer calls Cyg_StdioStreamBuffer::set_buffer that may fail for lack of memory. The returned error is silently ignored in the constructor of Cyg_StdioStreamBuffer. In this case the constructor of Cyg_StdioStream gives up, before the magic value is set.

So what are you suggesting? What is the fix? Could you provide a patch?

Thanks
Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]