Currently, split_args() of string.c has the __must_check attribute
which instructs gcc to warn whenever the return value of this function
is ignored by the caller.
However, since the returned array is NULL terminated anyway, there
are situations the return value my safely be ignored, for example if
the returned array is passed to execvp(), which does not receive a
length argument.
This patch removes the __must_check attribute and fixes a "set but
not used" warning on newer gcc versions.
static int open_pipe(char *path)
{
- int p[2], ret, argc;
+ int p[2], ret;
char **argv;
ret = pipe(p);
if (p[0] != STDIN_FILENO)
dup2(p[0], STDIN_FILENO);
DEBUG_LOG("executing %s\n", path);
- argc = split_args(path, &argv, " \t");
+ split_args(path, &argv, " \t");
execvp(argv[0], argv);
ERROR_LOG("error executing %s: %s\n", path,
adu_strerror(ERRNO_TO_ERROR(errno)));
*
* \return The number of substrings found in \a args.
*/
-__must_check unsigned split_args(char *args, char *** const argv_ptr, const char *delim)
+unsigned split_args(char *args, char *** const argv_ptr, const char *delim)
{
char *p = args;
char **argv;
__must_check __malloc __printf_1_2 char *make_message(const char *fmt, ...);
__must_check __malloc char *absolute_path(const char *path);
__must_check int atoi64(const char *str, int64_t *result);
-__must_check unsigned split_args(char *args, char *** const argv_ptr, const char *delim);
+unsigned split_args(char *args, char *** const argv_ptr, const char *delim);
int create_argv(const char *line, char ***result);
void free_argv(char **argv);