[CRIU] [PATCH 1/3] log: Simplify log_init
Cyrill Gorcunov
gorcunov at openvz.org
Sat Mar 3 16:39:22 EST 2012
- drop redundant current_logfd assignment
- assign new_logfd at the beginning
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
log.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/log.c b/log.c
index 9dde9bb..70f0b9d 100644
--- a/log.c
+++ b/log.c
@@ -30,7 +30,7 @@ int log_get_fd(void)
int log_init(const char *output)
{
struct rlimit rlimit;
- int new_logfd;
+ int new_logfd = DEFAULT_LOGFD;
if (getrlimit(RLIMIT_NOFILE, &rlimit)) {
pr_perror("Can't get rlimit");
@@ -54,9 +54,7 @@ int log_init(const char *output)
pr_perror("Can't create log file %s", output);
return -1;
}
- current_logfd = new_logfd;
- } else
- new_logfd = DEFAULT_LOGFD;
+ }
current_logfd = rlimit.rlim_cur - 1;
if (reopen_fd_as(current_logfd, new_logfd) < 0)
--
1.7.7.6
More information about the CRIU
mailing list