diff options
author | Simon Rettberg | 2015-12-16 11:13:39 +0100 |
---|---|---|
committer | Simon Rettberg | 2015-12-16 11:13:39 +0100 |
commit | 379436433bb4c9257a0af96025034065da623a0f (patch) | |
tree | a4ff399dad8dc79bdf12fa37790e685bfea22dcf /src/fuse/main.c | |
parent | [SERVER] Update config example (diff) | |
download | dnbd3-379436433bb4c9257a0af96025034065da623a0f.tar.gz dnbd3-379436433bb4c9257a0af96025034065da623a0f.tar.xz dnbd3-379436433bb4c9257a0af96025034065da623a0f.zip |
[FUSE] Fix forking mode (not passing -f) by not spawning threads before entering fuse_main
Diffstat (limited to 'src/fuse/main.c')
-rw-r--r-- | src/fuse/main.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/fuse/main.c b/src/fuse/main.c index eb4566a..c2b07be 100644 --- a/src/fuse/main.c +++ b/src/fuse/main.c @@ -39,11 +39,6 @@ static log_info logInfo; static struct timespec startupTime; static uid_t owner; -void error(const char *msg) -{ - perror( msg ); - exit( 0 ); -} static int image_getattr(const char *path, struct stat *stbuf) { @@ -156,8 +151,17 @@ static int image_read(const char *path, char *buf, size_t size, off_t offset, st } } +static void* image_init(struct fuse_conn_info *conn UNUSED) +{ + if ( !connection_initThreads() ) { + logadd( LOG_ERROR, "Could not initialize threads for dnbd3 connection, exiting..." ); + exit( EXIT_FAILURE ); + } + return NULL; +} + /* close the connection */ -void image_destroy(void *private_data UNUSED) +static void image_destroy(void *private_data UNUSED) { if ( useDebug ) { printLog( &logInfo ); @@ -172,6 +176,7 @@ static struct fuse_operations image_oper = { .readdir = image_readdir, .open = image_open, .read = image_read, + .init = image_init, .destroy = image_destroy, }; |