aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2020-01-07 11:25:43 +0100
committernsensfel <SpamShield0@noot-noot.org>2020-01-07 11:25:43 +0100
commit272e335b057dce34304d17074a81d3e3d0cde175 (patch)
tree40675a7019db9b249655293ed9d91ac1eb6d5f66
parent99fc3898606bf9bc2a732facffc1a6fe6bfcf3a2 (diff)
downloadrelabsd-272e335b057dce34304d17074a81d3e3d0cde175.zip
relabsd-272e335b057dce34304d17074a81d3e3d0cde175.tar.bz2
...
-rw-r--r--src/client.c2
-rw-r--r--src/config/parameters/parameters.c11
-rw-r--r--src/server/handle_client.c3
-rw-r--r--src/server/interruption.c10
4 files changed, 22 insertions, 4 deletions
diff --git a/src/client.c b/src/client.c
index c4c1148..0b84fe7 100644
--- a/src/client.c
+++ b/src/client.c
@@ -125,7 +125,7 @@ static int send_commands
(
i++;
((j > 0) && (i < argc));
- j++, i--
+ j--, i++
)
{
if (fputc(' ', socket) == EOF)
diff --git a/src/config/parameters/parameters.c b/src/config/parameters/parameters.c
index bff7642..eb06c42 100644
--- a/src/config/parameters/parameters.c
+++ b/src/config/parameters/parameters.c
@@ -357,6 +357,14 @@ int relabsd_parameters_argument_count_for
{
*result = 1;
}
+ else if
+ (
+ RELABSD_STRING_EQUALS("-q", option)
+ || RELABSD_STRING_EQUALS("--quit", option)
+ )
+ {
+ *result = 0;
+ }
else
{
return -1;
@@ -402,8 +410,7 @@ void relabsd_parameters_print_usage (const char exec [const restrict static 1])
"\t\tModifies an axis.\n\n"
"\t[-f | --config] <config_file>"
- "<options>:\n"
- "\t\t(Re)defines an axis.\n\n"
+ "\t\tUse the options defined in <config_file>.\n\n"
"\t[-q | --quit]:\n"
"\t\tTerminates the targeted server instance.\n\n"
diff --git a/src/server/handle_client.c b/src/server/handle_client.c
index a5eb7f7..bc18e95 100644
--- a/src/server/handle_client.c
+++ b/src/server/handle_client.c
@@ -40,6 +40,7 @@ int relabsd_server_handle_client
/* FIXME: reallocating at every new connection is kind of wasteful. */
char * input;
ssize_t input_size;
+ size_t input_buffer_size;
errno = 0;
socket_as_file = fdopen(socket, "r");
@@ -59,7 +60,7 @@ int relabsd_server_handle_client
errno = 0;
- input_size = getline(&input, (size_t *) NULL, socket_as_file);
+ input_size = getline(&input, &input_buffer_size, socket_as_file);
if (input_size < 1)
{
diff --git a/src/server/interruption.c b/src/server/interruption.c
index 7dabd3d..12d3c83 100644
--- a/src/server/interruption.c
+++ b/src/server/interruption.c
@@ -71,6 +71,16 @@ int relabsd_server_initialize_signal_handlers (void)
return -1;
}
+ if (signal(SIGTERM, interrupt) == SIG_ERR)
+ {
+ RELABSD_S_FATAL("Unable to set the SIGTERM signal handler.");
+
+ (void) close(RELABSD_INTERRUPTION_PIPES[0]);
+ (void) close(RELABSD_INTERRUPTION_PIPES[1]);
+
+ return -1;
+ }
+
return 0;
}