summaryrefslogtreecommitdiffstats
path: root/src/server/server.c
diff options
context:
space:
mode:
authorManuel Bentele2020-10-20 15:31:52 +0200
committerManuel Bentele2020-10-20 15:31:52 +0200
commit85c3fe47292f4e4e47a1f58f1347cb1f6d03b37e (patch)
treed8d7cf3d229bec1ec0b94747b5f427fd6bd6f063 /src/server/server.c
parent[BUILD] do not stop Release build if repository is dirty but warn (diff)
downloaddnbd3-85c3fe47292f4e4e47a1f58f1347cb1f6d03b37e.tar.gz
dnbd3-85c3fe47292f4e4e47a1f58f1347cb1f6d03b37e.tar.xz
dnbd3-85c3fe47292f4e4e47a1f58f1347cb1f6d03b37e.zip
[BUILD] add option to build the dnbd3-server with afl-fuzz support
The afl-fuzz support for the dnbd3-server requires an AFL C compiler like afl-gcc and can be enabled with the CMake option DNBD3_SERVER_AFL.
Diffstat (limited to 'src/server/server.c')
-rw-r--r--src/server/server.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/server/server.c b/src/server/server.c
index 55ec042..0ee51c4 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -217,6 +217,16 @@ int main(int argc, char *argv[])
{ 0, 0, 0, 0 }
};
+ log_init();
+
+ /* set proper output stream for AFL */
+#ifdef DNBD3_SERVER_AFL
+ if ( log_setConsoleOutputStream(stderr) < 0 ) {
+ logadd( LOG_ERROR, "Failed to set output stream for AFL to stderr" );
+ exit( EXIT_FAILURE );
+ }
+#endif
+
mainPid = getpid();
mainThread = pthread_self();
opt = getopt_long( argc, argv, optString, longOpts, &longIndex );
@@ -278,6 +288,7 @@ int main(int argc, char *argv[])
opt = getopt_long( argc, argv, optString, longOpts, &longIndex );
}
+
// Load general config
if ( _configDir == NULL ) _configDir = strdup( "/etc/dnbd3-server" );
@@ -291,8 +302,6 @@ int main(int argc, char *argv[])
timing_get( &startupTime );
#ifdef DNBD3_SERVER_AFL
- // ###### AFL
- //
image_serverStartup();
net_init();
uplink_globalsInit();
@@ -316,9 +325,7 @@ int main(int argc, char *argv[])
net_handleNewConnection( dnbd3_client );
exit( 0 );
}
- //
- // ###### AFL END
-#endif
+#endif /* DNBD3_SERVER_AFL */
// One-shots first: