mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
Fix GCC 7 string truncation warning, too small temporary buffer
In GCC 7 the -Wall infers the new -Wformat-truncation which finds problems with string truncation in functions like snprintf(). This patch suppresses the warning by allowing only a subset of the parent inetd service description to be copied to the child connection. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+5
-3
@@ -176,8 +176,10 @@ static void socket_cb(uev_t *w, void *arg, int events)
|
||||
/* Copy inherited attributes from inetd service's svc */
|
||||
task->runlevels = svc->runlevels;
|
||||
|
||||
/* Only copy the most relevant parts of inetd, in particular we
|
||||
* must *not* copy the watcher data to the clone! */
|
||||
/*
|
||||
* Only copy the most relevant parts of inetd, in particular we
|
||||
* must *not* copy the watcher data to the clone!
|
||||
*/
|
||||
task->inetd.svc = svc;
|
||||
task->inetd.cmd = svc->inetd.cmd;
|
||||
task->inetd.type = svc->inetd.type;
|
||||
@@ -186,7 +188,7 @@ static void socket_cb(uev_t *w, void *arg, int events)
|
||||
memcpy(task->username, svc->username, sizeof(task->username));
|
||||
memcpy(task->group, svc->group, sizeof(task->group));
|
||||
memcpy(task->args, svc->args, sizeof(task->args));
|
||||
snprintf(task->desc, sizeof(task->desc), "%s connection", svc->desc);
|
||||
snprintf(task->desc, sizeof(task->desc), "%52.52s connection", svc->desc);
|
||||
|
||||
task->stdin_fd = stdin;
|
||||
service_step(task);
|
||||
|
||||
Reference in New Issue
Block a user