mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-04 09:18:36 +03:00
cleanup: explicit check for nonnull pointer
Since execvp requires nonnull args - add explicit check.
This commit is contained in:
parent
dd4fdce16c
commit
dfca5dac9c
@ -54,7 +54,6 @@ int exec_cmd(struct cmd_context *cmd, const char *const argv[],
|
|||||||
int status;
|
int status;
|
||||||
char buf[PATH_MAX * 2];
|
char buf[PATH_MAX * 2];
|
||||||
|
|
||||||
|
|
||||||
if (rstatus)
|
if (rstatus)
|
||||||
*rstatus = -1;
|
*rstatus = -1;
|
||||||
|
|
||||||
@ -76,6 +75,7 @@ int exec_cmd(struct cmd_context *cmd, const char *const argv[],
|
|||||||
/* FIXME Fix effect of reset_locking on cache then include this */
|
/* FIXME Fix effect of reset_locking on cache then include this */
|
||||||
/* destroy_toolcontext(cmd); */
|
/* destroy_toolcontext(cmd); */
|
||||||
/* FIXME Use execve directly */
|
/* FIXME Use execve directly */
|
||||||
|
if (argv[0])
|
||||||
execvp(argv[0], (char **) argv);
|
execvp(argv[0], (char **) argv);
|
||||||
log_sys_error("execvp", argv[0]);
|
log_sys_error("execvp", argv[0]);
|
||||||
_exit(errno);
|
_exit(errno);
|
||||||
|
@ -1499,7 +1499,7 @@ int lvm2_main(int argc, char **argv)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (is_static() && strcmp(base, "lvm.static") &&
|
if (is_static() && strcmp(base, "lvm.static") &&
|
||||||
path_exists(LVM_SHARED_PATH) &&
|
path_exists(LVM_SHARED_PATH) && argv &&
|
||||||
!getenv("LVM_DID_EXEC")) {
|
!getenv("LVM_DID_EXEC")) {
|
||||||
if (setenv("LVM_DID_EXEC", base, 1))
|
if (setenv("LVM_DID_EXEC", base, 1))
|
||||||
log_sys_error("setenv", "LVM_DID_EXEC");
|
log_sys_error("setenv", "LVM_DID_EXEC");
|
||||||
|
Loading…
Reference in New Issue
Block a user