summaryrefslogtreecommitdiffstats
path: root/src/server/globals.c
diff options
context:
space:
mode:
authorSimon Rettberg2013-08-01 19:35:48 +0200
committerSimon Rettberg2013-08-01 19:35:48 +0200
commite7ad62c1b1627f7bab2524a4c30f1833f6b6767d (patch)
tree090473456331c3fa25eafc2db60e4c2808d808a9 /src/server/globals.c
parent[SERVER] Add command line options to create empty image of certain size with ... (diff)
downloaddnbd3-e7ad62c1b1627f7bab2524a4c30f1833f6b6767d.tar.gz
dnbd3-e7ad62c1b1627f7bab2524a4c30f1833f6b6767d.tar.xz
dnbd3-e7ad62c1b1627f7bab2524a4c30f1833f6b6767d.zip
[SERVER] Fix create_image() by adding fallback solutions for fallocate()
Diffstat (limited to 'src/server/globals.c')
-rw-r--r--src/server/globals.c9
1 files changed, 8 insertions, 1 deletions
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';
}