diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2010-11-01 14:17:35 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2010-11-01 14:17:35 +0000 |
commit | 2955b913ea0c34e12723537abc9af9cc8d14c3b3 (patch) | |
tree | 3c1c63adc54e96cf9253a0c8c7d346faa26540d9 /lib/misc/lvm-exec.c | |
parent | 13047cca5ac6caa204f39cbb8ac72dfd615f129f (diff) | |
download | lvm2-2955b913ea0c34e12723537abc9af9cc8d14c3b3.tar.gz lvm2-2955b913ea0c34e12723537abc9af9cc8d14c3b3.tar.xz lvm2-2955b913ea0c34e12723537abc9af9cc8d14c3b3.zip |
Use new status code from fsadm check
Patch updates exec_cmd() and adds 3rd parameter with pointer for
status value, so caller might examine returned status code.
If the passed pointer is NULL, behavior is unmodified.
Patch allows to confinue with lvresize if the failure from fsadm check is
caused by mounted filesystem as many of filesystem resize tools do support
online filesystem resize. (originally user had to use flag '-n' to bypass
this filesystem check)
Diffstat (limited to 'lib/misc/lvm-exec.c')
-rw-r--r-- | lib/misc/lvm-exec.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/misc/lvm-exec.c b/lib/misc/lvm-exec.c index d332aaa1..5cad79eb 100644 --- a/lib/misc/lvm-exec.c +++ b/lib/misc/lvm-exec.c @@ -46,7 +46,7 @@ static char *_verbose_args(const char *const argv[], char *buf, size_t sz) /* * Execute and wait for external command */ -int exec_cmd(struct cmd_context *cmd, const char *const argv[]) +int exec_cmd(struct cmd_context *cmd, const char *const argv[], int *rstatus) { pid_t pid; int status; @@ -71,6 +71,9 @@ int exec_cmd(struct cmd_context *cmd, const char *const argv[]) _exit(errno); } + if (rstatus) + *rstatus = -1; + /* Parent */ if (wait4(pid, &status, 0, NULL) != pid) { log_error("wait4 child process %u failed: %s", pid, @@ -84,9 +87,16 @@ int exec_cmd(struct cmd_context *cmd, const char *const argv[]) } if (WEXITSTATUS(status)) { - log_error("%s failed: %u", argv[0], WEXITSTATUS(status)); + if (rstatus) { + *rstatus = WEXITSTATUS(status); + log_verbose("%s failed: %u", argv[0], *rstatus); + } else + log_error("%s failed: %u", argv[0], WEXITSTATUS(status)); return 0; } + if (rstatus) + *rstatus = 0; + return 1; } |