From: Michael Tremer Date: Mon, 11 Jan 2021 17:53:00 +0000 (+0000) Subject: libpakfire: execute: Make argv const X-Git-Tag: 0.9.28~1285^2~895 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5cbd7cc8309867ce162bc94132238903566c95fb;p=pakfire.git libpakfire: execute: Make argv const This would be easier to handle because it usually comes as a const array and we can avoid creating a copy of it. Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/execute.c b/src/libpakfire/execute.c index 4025a2061..59f98743b 100644 --- a/src/libpakfire/execute.c +++ b/src/libpakfire/execute.c @@ -36,7 +36,7 @@ struct pakfire_execute_env { Pakfire pakfire; const char* root; const char* command; - char** argv; + const char** argv; char* envp[20]; }; @@ -55,13 +55,13 @@ static int pakfire_execute_fork(Pakfire pakfire, struct pakfire_execute_env* env } // exec() command - r = execve(env->command, env->argv, env->envp); + r = execve(env->command, (char**)env->argv, env->envp); // We should not get here return errno; } -PAKFIRE_EXPORT int pakfire_execute(Pakfire pakfire, const char* command, char** argv, int flags) { +PAKFIRE_EXPORT int pakfire_execute(Pakfire pakfire, const char* command, const char** argv, int flags) { struct pakfire_execute_env env; // Setup environment diff --git a/src/libpakfire/include/pakfire/execute.h b/src/libpakfire/include/pakfire/execute.h index d15459d3f..8f2b46bcc 100644 --- a/src/libpakfire/include/pakfire/execute.h +++ b/src/libpakfire/include/pakfire/execute.h @@ -23,6 +23,6 @@ #include -int pakfire_execute(Pakfire pakfire, const char* command, char** argv, int flags); +int pakfire_execute(Pakfire pakfire, const char* command, const char** argv, int flags); #endif /* PAKFIRE_EXECUTE_H */