From: Wouter Verhelst Date: Wed, 7 Jan 2009 12:10:11 +0000 (+0100) Subject: Minor fixes X-Git-Url: http://git.alex.org.uk 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. --- 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; }