mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00: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:
1 parent
13887f323a
commit
49481053a4
1 file changed
+5
-3
+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 */
|
/* Copy inherited attributes from inetd service's svc */
|
||||||
task->runlevels = svc->runlevels;
|
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.svc = svc;
|
||||||
task->inetd.cmd = svc->inetd.cmd;
|
task->inetd.cmd = svc->inetd.cmd;
|
||||||
task->inetd.type = svc->inetd.type;
|
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->username, svc->username, sizeof(task->username));
|
||||||
memcpy(task->group, svc->group, sizeof(task->group));
|
memcpy(task->group, svc->group, sizeof(task->group));
|
||||||
memcpy(task->args, svc->args, sizeof(task->args));
|
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;
|
task->stdin_fd = stdin;
|
||||||
service_step(task);
|
service_step(task);
|
||||||
|
|||||||
Reference in new issue
Block a user