summaryrefslogtreecommitdiffstats
path: root/lib/misc/lvm-exec.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-07-13 21:26:41 +0000
committerMikulas Patocka <mpatocka@redhat.com>2009-07-13 21:26:41 +0000
commit3395d728813d76824f0be66950d39f7758014990 (patch)
treea5cdcb87fd7adb671cdc5c1447c72f3b047d8ef6 /lib/misc/lvm-exec.c
parentf4b2b849049719b704132d87a2c0f62d130e0097 (diff)
downloadlvm2-3395d728813d76824f0be66950d39f7758014990.tar.gz
lvm2-3395d728813d76824f0be66950d39f7758014990.tar.xz
lvm2-3395d728813d76824f0be66950d39f7758014990.zip
Change exit() to _exit() in the child process. exit flushes stdio file buffers,
_exit doesn't. If there were some open files, an error in exec and subsequent exit() would cause the buffers to be flushed twice. Example: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> int main() { printf("buu"); if (!fork()) { execl("/bin/true-not-exists", "/bin/true", NULL); exit(1); } wait(NULL); return 0; } Signed-off-by: Mikulas Patocka <mpatocka@redhat.com --- daemons/dmeventd/libdevmapper-event.c | 2 +- lib/misc/lvm-exec.c | 2 +- test/harness.c | 3 ++- tools/dmsetup.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-)
Diffstat (limited to 'lib/misc/lvm-exec.c')
-rw-r--r--lib/misc/lvm-exec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/misc/lvm-exec.c b/lib/misc/lvm-exec.c
index fffdc37f..d332aaa1 100644
--- a/lib/misc/lvm-exec.c
+++ b/lib/misc/lvm-exec.c
@@ -68,7 +68,7 @@ int exec_cmd(struct cmd_context *cmd, const char *const argv[])
/* FIXME Use execve directly */
execvp(argv[0], (char **const) argv);
log_sys_error("execvp", argv[0]);
- exit(errno);
+ _exit(errno);
}
/* Parent */