]> git.kaiwu.me - njs.git/commitdiff
Fixed building by Clang.
authorDmitry Volyntsev <xeioex@nginx.com>
Wed, 6 Nov 2024 23:59:32 +0000 (15:59 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Thu, 7 Nov 2024 18:51:05 +0000 (10:51 -0800)
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

index 44e9fe95a342fa61ddff286090b9b5bb08097f8c..f9615668f83a98918f1d640211645f41a2ee5e00 100644 (file)
--- 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;