xen/tapdisk-ioemu-logfile.patch

35 lines
891 B
Diff
Raw Normal View History

Index: xen-3.3.1-testing/tools/ioemu-remote/tapdisk-ioemu.c
===================================================================
--- xen-3.3.1-testing.orig/tools/ioemu-remote/tapdisk-ioemu.c
+++ xen-3.3.1-testing/tools/ioemu-remote/tapdisk-ioemu.c
@@ -100,16 +100,23 @@ int main(void)
struct timeval tv;
void *old_fd_start = NULL;
- logfile = stderr;
-
+ /* Daemonize */
+ if (fork() != 0)
+ exit(0);
+
bdrv_init();
qemu_aio_init();
init_blktap();
- /* Daemonize */
- if (fork() != 0)
- exit(0);
-
+ logfile = fopen("/var/log/xen/tapdisk-ioemu.log", "a");
+ if (logfile) {
+ setbuf(logfile, NULL);
+ fclose(stderr);
+ stderr = logfile;
+ } else {
+ logfile = stderr;
+ }
+
/*
* Main loop: Pass events to the corrsponding handlers and check for
* completed aio operations.