[njs] Fixed a dead store.

Dmitry Volyntsev xeioex at nginx.com
Thu Mar 15 12:15:46 UTC 2018


details:   http://hg.nginx.org/njs/rev/720520457bfd
branches:  
changeset: 460:720520457bfd
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Thu Mar 15 15:15:24 2018 +0300
description:
Fixed a dead store.

Found by Clang Static Analyzer.

diffstat:

 nxt/nxt_random.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r 218db4540b15 -r 720520457bfd nxt/nxt_random.c
--- a/nxt/nxt_random.c	Thu Mar 15 15:15:23 2018 +0300
+++ b/nxt/nxt_random.c	Thu Mar 15 15:15:24 2018 +0300
@@ -64,14 +64,16 @@ nxt_random_stir(nxt_random_t *r, nxt_pid
 
     r->pid = pid;
 
-    n = 0;
-
 #if (NXT_HAVE_GETRANDOM)
 
     /* Linux 3.17 getrandom(), it is not available in Glibc. */
 
     n = syscall(SYS_getrandom, &key, NXT_RANDOM_KEY_SIZE, 0);
 
+#else
+
+    n = 0;
+
 #endif
 
     if (n != NXT_RANDOM_KEY_SIZE) {


More information about the nginx-devel mailing list