[njs] Fixed building by Clang.

noreply at nginx.com noreply at nginx.com
Thu Nov 7 18:52:02 UTC 2024


details:   https://github.com/nginx/njs/commit/e845d5e553ec6986ec133972544c4c1e171e4f52
branches:  master
commit:    e845d5e553ec6986ec133972544c4c1e171e4f52
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed, 6 Nov 2024 15:59:32 -0800
description:
Fixed building by Clang.

src/qjs.c:347:19: error: variable 'signo' may be uninitialized when used
	here [-Werror,-Wconditional-uninitialized]
  347 |     if (kill(pid, signo) < 0) {
      |                   ^~~~~
src/qjs.c:294:31: note: initialize the variable 'signo' to silence this
	warning
  294 |     int                  signo, pid;
      |                               ^
      |                                = 0
1 error generated.

---
 src/qjs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/qjs.c b/src/qjs.c
index 44e9fe95..f9615668 100644
--- a/src/qjs.c
+++ b/src/qjs.c
@@ -301,6 +301,8 @@ qjs_process_kill(JSContext *ctx, JSValueConst this_val, int argc,
         return JS_EXCEPTION;
     }
 
+    signo = SIGTERM;
+
     if (JS_IsNumber(argv[1])) {
         if (JS_ToInt32(ctx, &signo, argv[1]) < 0) {
             return JS_EXCEPTION;


More information about the nginx-devel mailing list