summaryrefslogtreecommitdiff
path: root/server/miav_server.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/miav_server.cc')
-rw-r--r--server/miav_server.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/miav_server.cc b/server/miav_server.cc
index 1682dad..1631c77 100644
--- a/server/miav_server.cc
+++ b/server/miav_server.cc
@@ -49,6 +49,8 @@
#include <grp.h>
#include <pwd.h>
+#include <stdlib.h>
+
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#elif defined(HAVE_STDLIB_H) // Solaris has getopt() here
@@ -70,7 +72,7 @@ static const char usage_str[] =
int main(int argc, char *argv[])
{
- char *config_file = ETC"/miav.conf";
+ const char *config_file = ETC"/miav.conf";
int optc;
int lose = 0;
@@ -166,7 +168,10 @@ int main(int argc, char *argv[])
if(!foreground) {
fprintf(stderr, "Entering daemon mode\n");
- daemon(0,0);
+ if(daemon(0,0) == -1) {
+ fprintf(stderr, "Could not fork.\n");
+ exit(1);
+ }
signal (SIGTERM, SIG_IGN);
signal (SIGINT, SIG_IGN);
signal (SIGHUP, SIG_IGN);