public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] libc/string/strsignal.c: Use of || not && lead to dead code.
  2017-03-15 17:41 [PATCH 1/2] rtems/crt0.c: getentropy() stub did not return a value Joel Sherrill
@ 2017-03-15 17:41 ` Joel Sherrill
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Sherrill @ 2017-03-15 17:41 UTC (permalink / raw)
  To: newlib; +Cc: Joel Sherrill

Coverity Id: 175333
---
 newlib/libc/string/strsignal.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/string/strsignal.c b/newlib/libc/string/strsignal.c
index 94ae26d..e32c9a7 100644
--- a/newlib/libc/string/strsignal.c
+++ b/newlib/libc/string/strsignal.c
@@ -37,7 +37,7 @@ QUICKREF
 /*
  *  Written by Joel Sherrill <joel.sherrill@OARcorp.com>.
  *
- *  COPYRIGHT (c) 2010.
+ *  COPYRIGHT (c) 2010, 2017.
  *  On-Line Applications Research Corporation (OAR).
  *
  *  Permission to use, copy, modify, and distribute this software for any
@@ -49,8 +49,6 @@ QUICKREF
  *  WARRANTY.  IN PARTICULAR,  THE AUTHOR MAKES NO REPRESENTATION
  *  OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
  *  SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
- *
- *  $Id$
  */
 
 #include <string.h>
@@ -72,7 +70,7 @@ _DEFUN (strsignal, (signal),
   buffer = _REENT_SIGNAL_BUF(ptr);
 
 #if defined(SIGRTMIN) && defined(SIGRTMAX)
-  if ((signal >= SIGRTMIN) || (signal <= SIGRTMAX)) {
+  if ((signal >= SIGRTMIN) && (signal <= SIGRTMAX)) {
     siprintf (buffer, "Real-time signal %d", signal - SIGRTMIN);
     return buffer;
   }
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/2] rtems/crt0.c: getentropy() stub did not return a value.
@ 2017-03-15 17:41 Joel Sherrill
  2017-03-15 17:41 ` [PATCH 2/2] libc/string/strsignal.c: Use of || not && lead to dead code Joel Sherrill
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Sherrill @ 2017-03-15 17:41 UTC (permalink / raw)
  To: newlib; +Cc: Joel Sherrill

Coverity Scan ID: 175342
---
 newlib/libc/sys/rtems/crt0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c
index 769cde7..0e9d426 100644
--- a/newlib/libc/sys/rtems/crt0.c
+++ b/newlib/libc/sys/rtems/crt0.c
@@ -68,7 +68,7 @@ RTEMS_STUB(void, _Libatomic_Lock_n(void *ptr, __size_t n), { });
 RTEMS_STUB(void, _Libatomic_Unlock_n(void *ptr, __size_t n), { });
 
 /* Stubs for routines for arc4random (from <unistd.h> and <machine/_arc4random.h> */
-RTEMS_STUB(int,  getentropy(void *ptr, __size_t n), { });
+RTEMS_STUB(int,  getentropy(void *ptr, __size_t n), { return -1; });
 RTEMS_STUB(void, _arc4random_getentropy_fail(void), { });
 
 #if defined(__GNUC__)
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-15 17:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-15 17:41 [PATCH 1/2] rtems/crt0.c: getentropy() stub did not return a value Joel Sherrill
2017-03-15 17:41 ` [PATCH 2/2] libc/string/strsignal.c: Use of || not && lead to dead code Joel Sherrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).