mirror of
https://github.com/troglobit/finit.git
synced 2026-10-29 12:40:44 +00:00
Merge pull request #29 from westermo/wmo/2.4
Allow debugging of inetd service's arguments
This commit is contained in:
commit
110ee220e7
1 file changed
+12
-12
@@ -112,7 +112,7 @@ static int is_norespawn(void)
|
|||||||
*/
|
*/
|
||||||
static int service_start(svc_t *svc)
|
static int service_start(svc_t *svc)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int i, result = 0;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
sigset_t nmask, omask;
|
sigset_t nmask, omask;
|
||||||
|
|
||||||
@@ -163,7 +163,6 @@ static int service_start(svc_t *svc)
|
|||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
int i = 0;
|
|
||||||
int status;
|
int status;
|
||||||
#ifdef ENABLE_STATIC
|
#ifdef ENABLE_STATIC
|
||||||
int uid = 0; /* XXX: Fix better warning that dropprivs is disabled. */
|
int uid = 0; /* XXX: Fix better warning that dropprivs is disabled. */
|
||||||
@@ -218,7 +217,6 @@ static int service_start(svc_t *svc)
|
|||||||
}
|
}
|
||||||
} else if (debug) {
|
} else if (debug) {
|
||||||
int fd;
|
int fd;
|
||||||
char buf[CMD_SIZE] = "";
|
|
||||||
|
|
||||||
fd = open(CONSOLE, O_WRONLY | O_APPEND);
|
fd = open(CONSOLE, O_WRONLY | O_APPEND);
|
||||||
if (-1 != fd) {
|
if (-1 != fd) {
|
||||||
@@ -226,15 +224,6 @@ static int service_start(svc_t *svc)
|
|||||||
dup2(fd, STDERR_FILENO);
|
dup2(fd, STDERR_FILENO);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_NUM_SVC_ARGS && args[i]; i++) {
|
|
||||||
char arg[MAX_ARG_LEN];
|
|
||||||
|
|
||||||
snprintf(arg, sizeof(arg), "%s ", args[i]);
|
|
||||||
if (strlen(arg) < (sizeof(buf) - strlen(buf)))
|
|
||||||
strcat(buf, arg);
|
|
||||||
}
|
|
||||||
_e("Starting %s: %s", svc->cmd, buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sig_unblock();
|
sig_unblock();
|
||||||
@@ -257,6 +246,17 @@ static int service_start(svc_t *svc)
|
|||||||
waitpid(pid, NULL, 0);
|
waitpid(pid, NULL, 0);
|
||||||
}
|
}
|
||||||
exit(status);
|
exit(status);
|
||||||
|
} else if (debug) {
|
||||||
|
char buf[CMD_SIZE] = "";
|
||||||
|
|
||||||
|
for (i = 0; i < (MAX_NUM_SVC_ARGS - 1) && svc->args[i][0] != 0; i++) {
|
||||||
|
char arg[MAX_ARG_LEN];
|
||||||
|
|
||||||
|
snprintf(arg, sizeof(arg), "%s ", svc->args[i]);
|
||||||
|
if (strlen(arg) < (sizeof(buf) - strlen(buf)))
|
||||||
|
strcat(buf, arg);
|
||||||
|
}
|
||||||
|
_e("Starting %s: %s", svc->cmd, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
svc->pid = pid;
|
svc->pid = pid;
|
||||||
|
|||||||
Reference in new issue
Block a user