]> sourceware.org Git - lvm2.git/commit
Change exit() to _exit() in the child process. exit flushes stdio file buffers,
authorMikulas Patocka <mpatocka@redhat.com>
Mon, 13 Jul 2009 21:26:41 +0000 (21:26 +0000)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 13 Jul 2009 21:26:41 +0000 (21:26 +0000)
commit3395d728813d76824f0be66950d39f7758014990
treea5cdcb87fd7adb671cdc5c1447c72f3b047d8ef6
parentf4b2b849049719b704132d87a2c0f62d130e0097
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.03788 seconds and 5 git commands to generate.