]> sourceware.org Git - lvm2.git/commit
Change exit() to _exit() in the child process. exit flushes stdio file buffers,
authormpatocka <mpatocka>
Mon, 13 Jul 2009 21:26:41 +0000 (21:26 +0000)
committermpatocka <mpatocka>
Mon, 13 Jul 2009 21:26:41 +0000 (21:26 +0000)
commit31b3571d314ed738b6a71203af748f9a2f20e65b
treea5cdcb87fd7adb671cdc5c1447c72f3b047d8ef6
parentee373a2721f6396c5860645930ea57e1ed7f6981
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(-)
daemons/dmeventd/libdevmapper-event.c
lib/misc/lvm-exec.c
test/harness.c
tools/dmsetup.c
This page took 0.039837 seconds and 5 git commands to generate.