The perror() after calling checkpoint() is useless -- stderr is closed.
Fix it by using dup2() to redirect stderr to the specified file. Do
the same for stdout just in case we want to use printf later.

Signed-off-by: Matt Helsley <matth...@us.ibm.com>
---
 simple/ckpt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/simple/ckpt.c b/simple/ckpt.c
index 739eb0a..2f7d0bb 100644
--- a/simple/ckpt.c
+++ b/simple/ckpt.c
@@ -62,8 +62,8 @@ int main(int argc, char *argv[])
 
        /* TODO these may no longer need to be closed? */
        close(0);
-       close(1);
-       close(2);
+       dup2(fileno(file), 1);
+       dup2(fileno(file), 2);
 
        fprintf(file, "hello, world!\n");
        fflush(file);
-- 
1.6.3.3

_______________________________________________
Containers mailing list
contain...@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
Devel@openvz.org
https://openvz.org/mailman/listinfo/devel

Reply via email to