chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus: properly handle if new objects are installed in the node tree while we are dispa...
[elogind.git]
/
src
/
activate
/
activate.c
diff --git
a/src/activate/activate.c
b/src/activate/activate.c
index be40be48a453855d9522ae1f8e6df0ce5ba9625b..83d25b13af9063e4c875c95e51b48c4e160644fd 100644
(file)
--- a/
src/activate/activate.c
+++ b/
src/activate/activate.c
@@
-137,6
+137,11
@@
static int open_sockets(int *epoll_fd, bool accept) {
count ++;
}
count ++;
}
+ /** Note: we leak some fd's on error here. I doesn't matter
+ * much, since the program will exit immediately anyway, but
+ * would be a pain to fix.
+ */
+
STRV_FOREACH(address, arg_listen) {
log_info("Opening address %s", *address);
STRV_FOREACH(address, arg_listen) {
log_info("Opening address %s", *address);
@@
-164,11
+169,12
@@
static int open_sockets(int *epoll_fd, bool accept) {
return count;
}
return count;
}
-static int launch(char* name, char **argv, char **env
iron
, int fds) {
+static int launch(char* name, char **argv, char **env, int fds) {
unsigned n_env = 0, length;
unsigned n_env = 0, length;
- char **envp = NULL, **s;
+ _cleanup_strv_free_ char **envp = NULL;
+ char **s;
static const char* tocopy[] = {"TERM=", "PATH=", "USER=", "HOME="};
static const char* tocopy[] = {"TERM=", "PATH=", "USER=", "HOME="};
-
char _cleanup_free_
*tmp = NULL;
+
_cleanup_free_ char
*tmp = NULL;
unsigned i;
length = strv_length(arg_environ);
unsigned i;
length = strv_length(arg_environ);
@@
-179,17
+185,17
@@
static int launch(char* name, char **argv, char **environ, int fds) {
if (strchr(*s, '='))
envp[n_env++] = *s;
else {
if (strchr(*s, '='))
envp[n_env++] = *s;
else {
-
char _cleanup_free_
*p = strappend(*s, "=");
+
_cleanup_free_ char
*p = strappend(*s, "=");
if (!p)
return log_oom();
if (!p)
return log_oom();
- envp[n_env] = strv_find_prefix(env
iron
, p);
+ envp[n_env] = strv_find_prefix(env, p);
if (envp[n_env])
n_env ++;
}
}
for (i = 0; i < ELEMENTSOF(tocopy); i++) {
if (envp[n_env])
n_env ++;
}
}
for (i = 0; i < ELEMENTSOF(tocopy); i++) {
- envp[n_env] = strv_find_prefix(env
iron
, tocopy[i]);
+ envp[n_env] = strv_find_prefix(env, tocopy[i]);
if (envp[n_env])
n_env ++;
}
if (envp[n_env])
n_env ++;
}
@@
-208,11
+214,11
@@
static int launch(char* name, char **argv, char **environ, int fds) {
return -errno;
}
return -errno;
}
-static int launch1(const char* child, char** argv, char **env
iron
, int fd) {
+static int launch1(const char* child, char** argv, char **env, int fd) {
pid_t parent_pid, child_pid;
int r;
pid_t parent_pid, child_pid;
int r;
-
char _cleanup_free_
*tmp = NULL;
+
_cleanup_free_ char
*tmp = NULL;
tmp = strv_join(argv, " ");
if (!tmp)
return log_oom();
tmp = strv_join(argv, " ");
if (!tmp)
return log_oom();
@@
-284,16
+290,15
@@
static int do_accept(const char* name, char **argv, char **envp, int fd) {
}
/* SIGCHLD handler. */
}
/* SIGCHLD handler. */
-static void sigchld_hdl(int sig, siginfo_t *t, void *data)
-{
+static void sigchld_hdl(int sig, siginfo_t *t, void *data) {
log_info("Child %d died with code %d", t->si_pid, t->si_status);
log_info("Child %d died with code %d", t->si_pid, t->si_status);
- /* Wait for a dead child. */
- waitpid(t->si_pid, NULL, 0);
+
/* Wait for a dead child. */
+
waitpid(t->si_pid, NULL, 0);
}
static int install_chld_handler(void) {
int r;
}
static int install_chld_handler(void) {
int r;
- struct sigaction act;
+
struct sigaction act;
zero(act);
act.sa_flags = SA_SIGINFO;
act.sa_sigaction = sigchld_hdl;
zero(act);
act.sa_flags = SA_SIGINFO;
act.sa_sigaction = sigchld_hdl;