From a3055ca43df3ec59e46618f0f78a2c4cf8cc8e18 Mon Sep 17 00:00:00 2001 From: Wouter Verhelst Date: Wed, 7 Jan 2009 13:10:11 +0100 Subject: [PATCH] Minor fixes - Gracefully handle when a config file contains a valid [generic] section, but no export sections - Free our key file stuff on successful parsing of the config file, too. --- nbd-server.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nbd-server.c b/nbd-server.c index bc390ab..754d21a 100644 --- a/nbd-server.c +++ b/nbd-server.c @@ -512,7 +512,9 @@ typedef enum { CFILE_KEY_MISSING, /**< A (required) key is missing */ CFILE_VALUE_INVALID, /**< A value is syntactically invalid */ CFILE_VALUE_UNSUPPORTED,/**< A value is not supported in this build */ - CFILE_PROGERR /**< Programmer error */ + CFILE_PROGERR, /**< Programmer error */ + CFILE_NO_EXPORTS /**< A config file was specified that does not + define any exports */ } CFILE_ERRORS; /** @@ -705,6 +707,10 @@ GArray* parse_cfile(gchar* f, GError** e) { } #endif } + if(i==1) { + g_set_error(e, errdomain, CFILE_NO_EXPORTS, "The config file does not specify any exports"); + } + g_key_file_free(cfile); return retval; } -- 1.7.10.4