From fdbedf5a8891afe54eb2e143e43de1b9bbc13f16 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 30 Oct 2013 02:48:38 +0400 Subject: [PATCH] crtools: add init_opts() Signed-off-by: Ruslan Kuprieiev Signed-off-by: Pavel Emelyanov --- crtools.c | 15 +++++++++++---- include/crtools.h | 2 ++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/crtools.c b/crtools.c index fe725bfb5..3b2919b80 100644 --- a/crtools.c +++ b/crtools.c @@ -33,6 +33,16 @@ struct cr_options opts; +void init_opts(void) +{ + memset(&opts, 0, sizeof(opts)); + + /* Default options */ + opts.final_state = TASK_DEAD; + INIT_LIST_HEAD(&opts.veth_pairs); + INIT_LIST_HEAD(&opts.scripts); +} + static int parse_ns_string(const char *ptr) { const char *end = ptr + strlen(ptr); @@ -77,10 +87,7 @@ int main(int argc, char *argv[]) if (argc < 2) goto usage; - /* Default options */ - opts.final_state = TASK_DEAD; - INIT_LIST_HEAD(&opts.veth_pairs); - INIT_LIST_HEAD(&opts.scripts); + init_opts(); if (init_service_fd()) return -1; diff --git a/include/crtools.h b/include/crtools.h index 85488693a..d6072a8b9 100644 --- a/include/crtools.h +++ b/include/crtools.h @@ -48,6 +48,8 @@ struct cr_options { extern struct cr_options opts; +extern void init_opts(void); + enum sfd_type { SERVICE_FD_MIN,