[rtems-libbsd commit] Fix ucred reference counting

Sebastian Huber sebh at rtems.org
Thu May 10 14:28:48 UTC 2012


Module:    rtems-libbsd
Branch:    master
Commit:    b41a35800b6b1e11eacd6c6b2bea819aafe3d8ff
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=b41a35800b6b1e11eacd6c6b2bea819aafe3d8ff

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Apr 27 09:38:25 2012 +0200

Fix ucred reference counting

---

 rtemsbsd/src/rtems-bsd-thread.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/rtemsbsd/src/rtems-bsd-thread.c b/rtemsbsd/src/rtems-bsd-thread.c
index e816570..f6b9abf 100644
--- a/rtemsbsd/src/rtems-bsd-thread.c
+++ b/rtemsbsd/src/rtems-bsd-thread.c
@@ -49,7 +49,9 @@
 RTEMS_CHAIN_DEFINE_EMPTY(rtems_bsd_thread_chain);
 
 /* FIXME: What to do with the credentials? */
-static struct ucred FIXME_ucred;
+static struct ucred FIXME_ucred = {
+  .cr_ref = 1
+};
 
 static int
 rtems_bsd_thread_start(struct thread **td_ptr, void (*func)(void *), void *arg, int flags, int pages, const char *fmt, va_list ap)
@@ -105,7 +107,7 @@ rtems_bsd_thread_start(struct thread **td_ptr, void (*func)(void *), void *arg,
 
 		td->td_id = id;
 		vsnprintf(td->td_name, sizeof(td->td_name), fmt, ap);
-		td->td_ucred = &FIXME_ucred;
+		td->td_ucred = crhold(&FIXME_ucred);
 
 		rtems_chain_append(&rtems_bsd_thread_chain, &td->td_node);
 




More information about the vc mailing list