From bf6bf2e36b82d1b98059b96ff2b3307ad4d895d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 27 Dec 2008 22:12:08 +0000 Subject: [PATCH] * get_context() didn't quite do what it was supposed to be doing. Especially, it was not guaranteed that this function returned a valid context even with low memory. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28826 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/libroot/posix/syslog.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/system/libroot/posix/syslog.cpp b/src/system/libroot/posix/syslog.cpp index 842c4704fb..ca50038cd2 100644 --- a/src/system/libroot/posix/syslog.cpp +++ b/src/system/libroot/posix/syslog.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved. + * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -67,9 +67,7 @@ get_context() return &sTeamContext; } - *tls_address(slot) = allocate_context(); sThreadContextSlot = slot; - return (syslog_context *)tls_get(slot); } else { while (sThreadContextSlot == -1) snooze(10000); @@ -81,7 +79,7 @@ get_context() // try to allocate the context again; it might have // been deleted, or there was not enough memory last // time - context = allocate_context(); + *tls_address(sThreadContextSlot) = context = allocate_context(); } if (context != NULL) return context;