summary refs log tree commit diff
path: root/src/subgetopt.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/subgetopt.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/subgetopt.c')
-rw-r--r--src/subgetopt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/subgetopt.c b/src/subgetopt.c
index 85ace96..a23e0d7 100644
--- a/src/subgetopt.c
+++ b/src/subgetopt.c
@@ -16,7 +16,7 @@ const char *optarg = 0;
 int optproblem = 0;
 int optdone = SUBGETOPTDONE;
 
-int sgopt(int argc,const char *const *argv,const char *opts)
+int sgopt(int argc,char *const *argv,const char *opts)
 {
   int c;
   const char *s;