[CRIU] [PATCHv2] log: add gnu-styled output to stdout
Dmitry Safonov
dsafonov at virtuozzo.com
Fri Mar 25 05:29:01 PDT 2016
Before this would open file named '-' as log:
./criu/criu dump -t 20526 -o -
But now it will print log into stdout. Charming.
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/log.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/criu/log.c b/criu/log.c
index 1435401abac5..6c5d807f8cd6 100644
--- a/criu/log.c
+++ b/criu/log.c
@@ -79,7 +79,13 @@ int log_init(const char *output)
gettimeofday(&start, NULL);
reset_buf_off();
- if (output) {
+ if (output && !strncmp(output, "-", 2)) {
+ new_logfd = dup(STDOUT_FILENO);
+ if (new_logfd < 0) {
+ pr_perror("Cant't dup stdout stream");
+ return -1;
+ }
+ } else if (output) {
new_logfd = open(output, O_CREAT|O_TRUNC|O_WRONLY|O_APPEND, 0600);
if (new_logfd < 0) {
pr_perror("Can't create log file %s", output);
--
2.7.4
More information about the CRIU
mailing list