From: John Hodge (sonata) Date: Wed, 28 Nov 2012 03:30:24 +0000 (+0800) Subject: Kernel/messages - Fixed IPCMSG flag not being reset when message queue is non-empty X-Git-Tag: rel0.15~646 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=45c96f859e03b62e366037052f4cb348c2323865;p=tpg%2Facess2.git Kernel/messages - Fixed IPCMSG flag not being reset when message queue is non-empty - Also fixed error in %p printing of NULL --- diff --git a/KernelLand/Kernel/libc.c b/KernelLand/Kernel/libc.c index c6df2cd6..8674650b 100644 --- a/KernelLand/Kernel/libc.c +++ b/KernelLand/Kernel/libc.c @@ -228,8 +228,12 @@ int vsnprintf(char *__s, size_t __maxlen, const char *__format, va_list args) PUTCH('*'); PUTCH('0'); PUTCH('x'); for( len = BITS/4; len -- && ((ptr>>(len*4))&15) == 0; ) ; - for( len ++; len --; ) - PUTCH( cUCDIGITS[ (ptr>>(len*4))&15 ] ); + len ++; + if( len == 0 ) + PUTCH( '0' ); + else + while( len -- ) + PUTCH( cUCDIGITS[ (ptr>>(len*4))&15 ] ); continue ; } diff --git a/KernelLand/Kernel/messages.c b/KernelLand/Kernel/messages.c index c9919780..82374233 100644 --- a/KernelLand/Kernel/messages.c +++ b/KernelLand/Kernel/messages.c @@ -137,10 +137,13 @@ int Proc_GetMessage(Uint *Source, Uint BufSize, void *Buffer) // Remove from list tmp = cur->Messages; cur->Messages = cur->Messages->Next; + // - Removed last message? Clear the end-of-list pointer if(cur->Messages == NULL) cur->LastMessage = NULL; + // > Otherwise, re-mark the IPCMSG event flag + else cur->EventState |= THREAD_EVENT_IPCMSG; SHORTREL( &cur->IsLocked ); - + free(tmp); // Free outside of lock LEAVE('i', ret);