Make sudo pass -Wwrite-strings

This commit is contained in:
Todd C. Miller
2022-06-28 16:33:15 -06:00
parent b3a8cad346
commit 13672f28df
77 changed files with 590 additions and 640 deletions

View File

@@ -36,8 +36,8 @@ _sudo_ConvMessage__Init(PyObject *py_self, PyObject *py_args, PyObject *py_kwarg
struct sudo_conv_message conv_message = { 0, 0, NULL };
static char *keywords[] = { "self", "msg_type", "msg", "timeout", NULL };
if (!PyArg_ParseTupleAndKeywords(py_args ? py_args : py_empty, py_kwargs, "Ois|i:sudo.ConvMessage", keywords,
static const char *keywords[] = { "self", "msg_type", "msg", "timeout", NULL };
if (!PyArg_ParseTupleAndKeywords(py_args ? py_args : py_empty, py_kwargs, "Ois|i:sudo.ConvMessage", (char **)keywords,
&py_self, &(conv_message.msg_type), &(conv_message.msg),
&(conv_message.timeout)))
goto cleanup;

View File

@@ -101,7 +101,7 @@ _import_module(const char *path)
if (strlcpy(path_copy, path, sizeof(path_copy)) >= sizeof(path_copy))
debug_return_ptr(NULL);
char *module_dir = path_copy;
const char *module_dir = path_copy;
char *module_name = strrchr(path_copy, '/');
if (module_name == NULL) {
module_name = path_copy;

View File

@@ -106,11 +106,11 @@ init(void)
memset(&data, 0, sizeof(data));
memset(&example_pwd, 0, sizeof(example_pwd));
example_pwd.pw_name = "pw_name";
example_pwd.pw_passwd = "pw_passwd";
example_pwd.pw_gecos = "pw_gecos";
example_pwd.pw_shell ="pw_shell";
example_pwd.pw_dir = "pw_dir";
example_pwd.pw_name = (char *)"pw_name";
example_pwd.pw_passwd = (char *)"pw_passwd";
example_pwd.pw_gecos = (char *)"pw_gecos";
example_pwd.pw_shell = (char *)"pw_shell";
example_pwd.pw_dir = (char *)"pw_dir";
example_pwd.pw_uid = (uid_t)1001;
example_pwd.pw_gid = (gid_t)101;

View File

@@ -79,8 +79,8 @@ _parse_log_function_args(PyObject *py_args, PyObject *py_kwargs, char **args_joi
if (py_empty == NULL)
goto cleanup;
static char *keywords[] = { "sep", "end", NULL };
if (py_kwargs != NULL && !PyArg_ParseTupleAndKeywords(py_empty, py_kwargs, "|zz:sudo.log", keywords, &sep, end))
static const char *keywords[] = { "sep", "end", NULL };
if (py_kwargs != NULL && !PyArg_ParseTupleAndKeywords(py_empty, py_kwargs, "|zz:sudo.log", (char **)keywords, &sep, end))
goto cleanup;
if (sep == NULL)
@@ -330,8 +330,8 @@ python_sudo_conversation(PyObject *Py_UNUSED(self), PyObject *py_args, PyObject
if (py_empty == NULL)
goto cleanup;
static char *keywords[] = { "on_suspend", "on_resume", NULL };
if (py_kwargs != NULL && !PyArg_ParseTupleAndKeywords(py_empty, py_kwargs, "|OO:sudo.conv", keywords,
static const char *keywords[] = { "on_suspend", "on_resume", NULL };
if (py_kwargs != NULL && !PyArg_ParseTupleAndKeywords(py_empty, py_kwargs, "|OO:sudo.conv", (char **)keywords,
&callback_closure.py_on_suspend,
&callback_closure.py_on_resume))
goto cleanup;