mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-30 22:05:46 +00:00
Eliminate a few harmless dead stores.
Quiets warnings from Infer.
This commit is contained in:
@@ -156,7 +156,7 @@ json_append_string(struct json_container *jsonc, const char *str)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*cp++ = ch;
|
*cp++ = ch;
|
||||||
*cp++ = '\0';
|
*cp = '\0';
|
||||||
if (!json_append_buf(jsonc, buf))
|
if (!json_append_buf(jsonc, buf))
|
||||||
debug_return_bool(false);
|
debug_return_bool(false);
|
||||||
}
|
}
|
||||||
|
@@ -150,7 +150,7 @@ next_entry:
|
|||||||
gr.gr_mem[n] = cp;
|
gr.gr_mem[n] = cp;
|
||||||
cp = strtok_r(NULL, ",", &last);
|
cp = strtok_r(NULL, ",", &last);
|
||||||
}
|
}
|
||||||
gr.gr_mem[n++] = NULL;
|
gr.gr_mem[n] = NULL;
|
||||||
} else
|
} else
|
||||||
gr.gr_mem = NULL;
|
gr.gr_mem = NULL;
|
||||||
return &gr;
|
return &gr;
|
||||||
|
@@ -328,7 +328,7 @@ alias_make_unique(const char *old_name, int type,
|
|||||||
struct sudoers_parse_tree *parse_tree0,
|
struct sudoers_parse_tree *parse_tree0,
|
||||||
struct sudoers_parse_tree *merged_tree)
|
struct sudoers_parse_tree *merged_tree)
|
||||||
{
|
{
|
||||||
struct sudoers_parse_tree *parse_tree = parse_tree0;
|
struct sudoers_parse_tree *parse_tree;
|
||||||
char *cp, *new_name = NULL;
|
char *cp, *new_name = NULL;
|
||||||
struct alias *a;
|
struct alias *a;
|
||||||
long long suffix;
|
long long suffix;
|
||||||
|
@@ -692,7 +692,7 @@ matches_env_check(const char *var, bool *full_match)
|
|||||||
} else {
|
} else {
|
||||||
const char *val = strchr(var, '=');
|
const char *val = strchr(var, '=');
|
||||||
if (val != NULL)
|
if (val != NULL)
|
||||||
keepit = !strpbrk(++val, "/%");
|
keepit = !strpbrk(val + 1, "/%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug_return_int(keepit);
|
debug_return_int(keepit);
|
||||||
|
@@ -787,10 +787,8 @@ sudoers_io_open(unsigned int version, sudo_conv_t conversation,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sudoers_debug_register(plugin_path, &debug_files)) {
|
if (!sudoers_debug_register(plugin_path, &debug_files))
|
||||||
ret = -1;
|
|
||||||
goto done;
|
goto done;
|
||||||
}
|
|
||||||
|
|
||||||
/* If we have no command (because -V was specified) just return. */
|
/* If we have no command (because -V was specified) just return. */
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
|
@@ -204,7 +204,7 @@ static int
|
|||||||
sudo_ldap_init(LDAP **ldp, const char *host, int port)
|
sudo_ldap_init(LDAP **ldp, const char *host, int port)
|
||||||
{
|
{
|
||||||
LDAP *ld;
|
LDAP *ld;
|
||||||
int ret = LDAP_CONNECT_ERROR;
|
int ret;
|
||||||
debug_decl(sudo_ldap_init, SUDOERS_DEBUG_LDAP);
|
debug_decl(sudo_ldap_init, SUDOERS_DEBUG_LDAP);
|
||||||
|
|
||||||
#ifdef HAVE_LDAPSSL_INIT
|
#ifdef HAVE_LDAPSSL_INIT
|
||||||
@@ -281,8 +281,10 @@ sudo_ldap_init(LDAP **ldp, const char *host, int port)
|
|||||||
ret = ldap_set_option(ld, LDAP_OPT_HOST_NAME, host);
|
ret = ldap_set_option(ld, LDAP_OPT_HOST_NAME, host);
|
||||||
#else
|
#else
|
||||||
DPRINTF2("ldap_init(%s, %d)", host, port);
|
DPRINTF2("ldap_init(%s, %d)", host, port);
|
||||||
if ((ld = ldap_init((char *)host, port)) == NULL)
|
if ((ld = ldap_init((char *)host, port)) == NULL) {
|
||||||
|
ret = LDAP_LOCAL_ERROR;
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
ret = LDAP_SUCCESS;
|
ret = LDAP_SUCCESS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -509,7 +509,7 @@ sudo_krb5_ccname_path(const char *old_ccname)
|
|||||||
static bool
|
static bool
|
||||||
sudo_check_krb5_ccname(const char *ccname)
|
sudo_check_krb5_ccname(const char *ccname)
|
||||||
{
|
{
|
||||||
int fd = -1;
|
int fd;
|
||||||
const char *ccname_path;
|
const char *ccname_path;
|
||||||
debug_decl(sudo_check_krb5_ccname, SUDOERS_DEBUG_LDAP);
|
debug_decl(sudo_check_krb5_ccname, SUDOERS_DEBUG_LDAP);
|
||||||
|
|
||||||
|
@@ -1085,7 +1085,7 @@ done:
|
|||||||
static bool
|
static bool
|
||||||
fmt_initial_message(struct client_closure *closure)
|
fmt_initial_message(struct client_closure *closure)
|
||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = false;
|
||||||
debug_decl(fmt_initial_message, SUDOERS_DEBUG_UTIL);
|
debug_decl(fmt_initial_message, SUDOERS_DEBUG_UTIL);
|
||||||
|
|
||||||
closure->state = closure->initial_state;
|
closure->state = closure->initial_state;
|
||||||
@@ -1116,7 +1116,6 @@ fmt_initial_message(struct client_closure *closure)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sudo_warnx(U_("%s: unexpected state %d"), __func__, closure->state);
|
sudo_warnx(U_("%s: unexpected state %d"), __func__, closure->state);
|
||||||
ret = false;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
debug_return_bool(ret);
|
debug_return_bool(ret);
|
||||||
|
@@ -185,7 +185,7 @@ static bool
|
|||||||
open_cmnd(const char *path, const char *runchroot,
|
open_cmnd(const char *path, const char *runchroot,
|
||||||
const struct command_digest_list *digests, int *fdp)
|
const struct command_digest_list *digests, int *fdp)
|
||||||
{
|
{
|
||||||
int fd = -1;
|
int fd;
|
||||||
char pathbuf[PATH_MAX];
|
char pathbuf[PATH_MAX];
|
||||||
debug_decl(open_cmnd, SUDOERS_DEBUG_MATCH);
|
debug_decl(open_cmnd, SUDOERS_DEBUG_MATCH);
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ strvec_join(char *const argv[], char sep, size_t (*cpy)(char *, const char *, si
|
|||||||
*dst++ = sep;
|
*dst++ = sep;
|
||||||
size--;
|
size--;
|
||||||
}
|
}
|
||||||
*--dst = '\0';
|
dst[-1] = '\0';
|
||||||
|
|
||||||
debug_return_str(result);
|
debug_return_str(result);
|
||||||
}
|
}
|
||||||
|
@@ -300,7 +300,7 @@ next_entry:
|
|||||||
gr.gr_mem[n] = cp;
|
gr.gr_mem[n] = cp;
|
||||||
cp = strtok_r(NULL, ",", &last);
|
cp = strtok_r(NULL, ",", &last);
|
||||||
}
|
}
|
||||||
gr.gr_mem[n++] = NULL;
|
gr.gr_mem[n] = NULL;
|
||||||
} else
|
} else
|
||||||
gr.gr_mem = NULL;
|
gr.gr_mem = NULL;
|
||||||
return &gr;
|
return &gr;
|
||||||
|
@@ -540,7 +540,7 @@ edit_sudoers(struct sudoersfile *sp, char *editor, int editor_argc,
|
|||||||
}
|
}
|
||||||
editor_argv[ac++] = (char *)"--";
|
editor_argv[ac++] = (char *)"--";
|
||||||
editor_argv[ac++] = sp->tpath;
|
editor_argv[ac++] = sp->tpath;
|
||||||
editor_argv[ac++] = NULL;
|
editor_argv[ac] = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do the edit:
|
* Do the edit:
|
||||||
|
@@ -355,7 +355,7 @@ os_init_common(int argc, char *argv[], char *envp[])
|
|||||||
static void
|
static void
|
||||||
fix_fds(void)
|
fix_fds(void)
|
||||||
{
|
{
|
||||||
int miss[3], devnull = -1;
|
int miss[3];
|
||||||
debug_decl(fix_fds, SUDO_DEBUG_UTIL);
|
debug_decl(fix_fds, SUDO_DEBUG_UTIL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -366,7 +366,8 @@ fix_fds(void)
|
|||||||
miss[STDOUT_FILENO] = fcntl(STDOUT_FILENO, F_GETFL, 0) == -1;
|
miss[STDOUT_FILENO] = fcntl(STDOUT_FILENO, F_GETFL, 0) == -1;
|
||||||
miss[STDERR_FILENO] = fcntl(STDERR_FILENO, F_GETFL, 0) == -1;
|
miss[STDERR_FILENO] = fcntl(STDERR_FILENO, F_GETFL, 0) == -1;
|
||||||
if (miss[STDIN_FILENO] || miss[STDOUT_FILENO] || miss[STDERR_FILENO]) {
|
if (miss[STDIN_FILENO] || miss[STDOUT_FILENO] || miss[STDERR_FILENO]) {
|
||||||
devnull = open(_PATH_DEVNULL, O_RDWR, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
|
int devnull =
|
||||||
|
open(_PATH_DEVNULL, O_RDWR, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
|
||||||
if (devnull == -1)
|
if (devnull == -1)
|
||||||
sudo_fatal(U_("unable to open %s"), _PATH_DEVNULL);
|
sudo_fatal(U_("unable to open %s"), _PATH_DEVNULL);
|
||||||
if (miss[STDIN_FILENO] && dup2(devnull, STDIN_FILENO) == -1)
|
if (miss[STDIN_FILENO] && dup2(devnull, STDIN_FILENO) == -1)
|
||||||
@@ -1105,7 +1106,7 @@ format_plugin_settings(struct plugin_container *plugin)
|
|||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plugin_settings[++i] = NULL;
|
plugin_settings[i + 1] = NULL;
|
||||||
|
|
||||||
/* Add to list of vectors to be garbage collected at exit. */
|
/* Add to list of vectors to be garbage collected at exit. */
|
||||||
if (!gc_add(GC_VECTOR, plugin_settings))
|
if (!gc_add(GC_VECTOR, plugin_settings))
|
||||||
|
Reference in New Issue
Block a user