From: Justin Mitchell <jumitche@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH 4/7] nfs-utils: Indicate if config file was missing
Date: Mon, 23 Apr 2018 16:26:58 +0100 [thread overview]
Message-ID: <1524497218.7418.7.camel@redhat.com> (raw)
In-Reply-To: <1524496788.7418.2.camel@redhat.com>
Return an indication that the config file could not be loaded
for processes that want to differentiate this from empty config
Signed-off-by: Justin Mitchell <jumitche@redhat.com>
---
support/include/conffile.h | 2 +-
support/nfs/conffile.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/support/include/conffile.h b/support/include/conffile.h
index ad20067..6baaf9a 100644
--- a/support/include/conffile.h
+++ b/support/include/conffile.h
@@ -60,7 +60,7 @@ extern _Bool conf_get_bool(const char *, const char *, _Bool);
extern char *conf_get_str(const char *, const char *);
extern char *conf_get_str_with_def(const char *, const char *, char *);
extern char *conf_get_section(const char *, const char *, const char *);
-extern void conf_init_file(const char *);
+extern int conf_init_file(const char *);
extern void conf_cleanup(void);
extern int conf_match_num(const char *, const char *, int);
extern int conf_remove(int, const char *, const char *);
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index fe41de5..7ed5646 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -522,7 +522,7 @@ static void conf_free_bindings(void)
}
/* Open the config file and map it into our address space, then parse it. */
-static void
+static int
conf_load_file(const char *conf_file)
{
int trans;
@@ -532,7 +532,7 @@ conf_load_file(const char *conf_file)
conf_data = conf_readfile(conf_file);
if (conf_data == NULL)
- return;
+ return 1;
/* Load default configuration values. */
conf_load_defaults();
@@ -550,10 +550,10 @@ conf_load_file(const char *conf_file)
/* Apply the new configuration values */
conf_end(trans, 1);
- return;
+ return 0;
}
-void
+int
conf_init_file(const char *conf_file)
{
unsigned int i;
@@ -564,7 +564,7 @@ conf_init_file(const char *conf_file)
TAILQ_INIT (&conf_trans_queue);
if (conf_file == NULL) conf_file=NFS_CONFFILE;
- conf_load_file(conf_file);
+ return conf_load_file(conf_file);
}
/*
--
1.8.3.1
next prev parent reply other threads:[~2018-04-23 15:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 15:19 [PATCH 0/7] nfs-utils: nfsconf cli tool and code tests Justin Mitchell
2018-04-23 15:24 ` [PATCH 1/7] nfs-utils: Fix minor memory leaks Justin Mitchell
2018-04-23 15:25 ` [PATCH 2/7] nfs-utils: Make config includes relative to current config Justin Mitchell
2018-05-02 18:21 ` Steve Dickson
2018-05-03 10:11 ` Justin Mitchell
2018-04-23 15:26 ` [PATCH 3/7] nfs-utils: Use config file name in error messages Justin Mitchell
2018-04-23 15:26 ` Justin Mitchell [this message]
2018-04-23 15:27 ` [PATCH 5/7] nfs-utils: tidy up output of conf_report Justin Mitchell
2018-05-02 18:24 ` Steve Dickson
2018-04-23 15:34 ` [PATCH 6/7] nfs-utils: Add nfsconftool cli Justin Mitchell
2018-05-02 18:25 ` Steve Dickson
2018-04-23 15:35 ` [PATCH 7/7] nfs-utils: use nfsconftool cli to test library function Justin Mitchell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1524497218.7418.7.camel@redhat.com \
--to=jumitche@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.