Fixing a problem on savefile (stdin was not saved well, and the file not saveflie
authorviric <viriketo@gmail.com>
Wed, 16 Feb 2011 21:07:11 +0100
branchsaveflie
changeset 95 13360d8af313
parent 94 330324fc7c20
child 96 d090ddac5131
Fixing a problem on savefile (stdin was not saved well, and the file not truncated)
app_control.c
server.c
--- a/app_control.c	Wed Feb 16 20:57:32 2011 +0100
+++ b/app_control.c	Wed Feb 16 21:07:11 2011 +0100
@@ -159,6 +159,8 @@
     {
         hex_dump("from local to app", buffer, size);
         write(app_stdin, buffer, size);
+        if (savefile != -1)
+            write(savefile, buffer, size);
     }
 }
 
--- a/server.c	Wed Feb 16 20:57:32 2011 +0100
+++ b/server.c	Wed Feb 16 21:07:11 2011 +0100
@@ -149,7 +149,8 @@
 
     if (command_line.s_param.savefile)
     {
-        savefile = open(command_line.s_param.savefile, O_CREAT | O_RDWR, 0666);
+        savefile = open(command_line.s_param.savefile,
+                O_CREAT | O_TRUNC | O_RDWR, 0666);
     }
 
     child = fork_app(command_line.s_param.command);