summary refs log tree commit diff
path: root/src/runsvdir.c
diff options
context:
space:
mode:
authorZ. Liu <zhixu.liu@gmail.com>2024-08-25 01:32:48 +0800
committerGerrit Pape <pape@smarden.org>2024-09-25 23:34:19 +0000
commit977abd9a06683c29d6888aecbf941386587c7c0e (patch)
tree34b3850a2edd4755bca1d2270685d7b0f43610df /src/runsvdir.c
parent4b32d478dedfdcf292f0aaddc29d91768fe1585f (diff)
downloadrunit-977abd9a06683c29d6888aecbf941386587c7c0e.tar.gz
runit-977abd9a06683c29d6888aecbf941386587c7c0e.tar.xz
runit-977abd9a06683c29d6888aecbf941386587c7c0e.zip
fix compilation warning(s): -Wincompatible-pointer-types-discards-qualifiers
found by using clang 18 with CFLAGS: -Wall

since gcc 14, certain warnings (including this one, gcc report as
-Wincompatible-pointer-types) are now errors, see
https://gcc.gnu.org/gcc-14/porting_to.html

link of debian's patches is: https://salsa.debian.org/debian/runit/-/tree/master/debian/patches
  0014-fix-implicit-declarations-incompatible-types-argv-ty.patch

pathexec_run.c: warning: passing 'const char *const *' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
   19 |     execve(file,argv,envp);
      |                 ^~~~ ^~~~
   36 |     execve(tmp.s,argv,envp);
      |                  ^~~~ ^~~~
pathexec_env.c:67:21: warning: passing 'const char *const *' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
   67 |   pathexec_run(file,argv,e);
      |                     ^~~~
pathexec_env.c:67:26: warning: passing 'const char **' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
   67 |   pathexec_run(file,argv,e);
      |                          ^
runsvdir.c:74:25: warning: passing 'const char *[3]' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
   74 |     pathexec_run(*prog, prog, (const char* const*)environ);
      |                         ^~~~
runsvdir.c:74:31: warning: passing 'const char *const *' to parameter of type 'char *const *' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers]
   74 |     pathexec_run(*prog, prog, (const char* const*)environ);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
Diffstat (limited to 'src/runsvdir.c')
-rw-r--r--src/runsvdir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runsvdir.c b/src/runsvdir.c
index ecebd0a..28cb044 100644
--- a/src/runsvdir.c
+++ b/src/runsvdir.c
@@ -63,7 +63,7 @@ void runsv(int no, char *name) {
   }
   if (pid == 0) {
     /* child */
-    const char *prog[3];
+    char *prog[3];
 
     prog[0] ="runsv";
     prog[1] =name;
@@ -71,7 +71,7 @@ void runsv(int no, char *name) {
     sig_uncatch(sig_hangup);
     sig_uncatch(sig_term);
     if (pgrp) setsid();
-    pathexec_run(*prog, prog, (const char* const*)environ);
+    pathexec_run(*prog, prog, (char* const*)environ);
     fatal("unable to start runsv ", name);
   }
   sv[no].pid =pid;