From e7ad62c1b1627f7bab2524a4c30f1833f6b6767d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 1 Aug 2013 19:35:48 +0200 Subject: [SERVER] Fix create_image() by adding fallback solutions for fallocate() --- src/server/globals.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/server/globals.c') diff --git a/src/server/globals.c b/src/server/globals.c index d84e3f7..182b2cc 100644 --- a/src/server/globals.c +++ b/src/server/globals.c @@ -29,8 +29,15 @@ void globals_loadConfig() if ( name == NULL ) return; ini_parse( name, &ini_handler, NULL ); free( name ); - if ( _basePath != NULL && _basePath[0] != '/' ) { + if ( _basePath == NULL || _basePath[0] == '\0' ) { + memlogf( "[ERROR] Need to specify basePath in " CONFIG_FILENAME ); + exit( EXIT_FAILURE ); + } + if ( _basePath[0] != '/' ) { memlogf( "[ERROR] _basePath must be absolute!" ); exit( EXIT_FAILURE ); } + char *end = _basePath + strlen( _basePath ) - 1; + while ( end >= _basePath && *end == '/' ) + *end-- = '\0'; } -- cgit v1.2.3-55-g7522