From c6adc4ba8e292a74239e51a4d67a4a9295690712 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 5 Aug 2018 16:23:07 -0600 Subject: [PATCH] sched/pthread/pthread_initialize.c: Fix a warning found in build testing (that is actually and bug and would cause an incorrect value to be returned in many cases. --- sched/pthread/pthread_initialize.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sched/pthread/pthread_initialize.c b/sched/pthread/pthread_initialize.c index ccdab7a8d9..95cf18700a 100644 --- a/sched/pthread/pthread_initialize.c +++ b/sched/pthread/pthread_initialize.c @@ -1,7 +1,8 @@ /**************************************************************************** * sched/pthread/pthread_initialize.c * - * Copyright (C) 2007-2010, 2013, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2013, 2017-2018 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -155,7 +156,7 @@ int pthread_sem_trytake(sem_t *sem) /* Try to take the semaphore */ int status = nxsem_trywait(sem); - ret = ret < 0 ? -ret : OK; + ret = status < 0 ? -status : OK; } return ret; @@ -168,7 +169,6 @@ int pthread_sem_give(sem_t *sem) /* Verify input parameters */ - DEBUGASSERT(sem != NULL); if (sem != NULL) {