diff options
author | Daniel Mack <github@zonque.org> | 2015-11-02 10:10:44 +0100 |
---|---|---|
committer | Daniel Mack <github@zonque.org> | 2015-11-02 10:10:44 +0100 |
commit | d0744e54eb83a9f4e4f54a59de3905699a667be0 (patch) | |
tree | 67deec65f866186503d4a45c1197121625b159cb /src/basic | |
parent | 534e8f89d6367cd0e9e17fff67880fb430071d01 (diff) | |
parent | 3958325852869a5e490b5741016c93b8b9a80e11 (diff) |
Merge pull request #1745 from poettering/journal-deadlock
Make sure journald never blocks on sd_notify() to PID 1
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/env-util.c | 11 | ||||
-rw-r--r-- | src/basic/env-util.h | 2 | ||||
-rw-r--r-- | src/basic/fdset.c | 2 | ||||
-rw-r--r-- | src/basic/fdset.h | 2 |
4 files changed, 15 insertions, 2 deletions
diff --git a/src/basic/env-util.c b/src/basic/env-util.c index 94cb251698..9ddac5d6a1 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c @@ -25,6 +25,7 @@ #include "alloc-util.h" #include "def.h" #include "env-util.h" +#include "parse-util.h" #include "string-util.h" #include "strv.h" #include "utf8.h" @@ -594,3 +595,13 @@ char **replace_env_argv(char **argv, char **env) { ret[k] = NULL; return ret; } + +int getenv_bool(const char *p) { + const char *e; + + e = getenv(p); + if (!e) + return -ENXIO; + + return parse_boolean(e); +} diff --git a/src/basic/env-util.h b/src/basic/env-util.h index 803aa61cad..6485dade18 100644 --- a/src/basic/env-util.h +++ b/src/basic/env-util.h @@ -47,3 +47,5 @@ char **strv_env_unset_many(char **l, ...) _sentinel_; char *strv_env_get_n(char **l, const char *name, size_t k) _pure_; char *strv_env_get(char **x, const char *n) _pure_; + +int getenv_bool(const char *p); diff --git a/src/basic/fdset.c b/src/basic/fdset.c index 4b11e4ea09..42b0b2b98f 100644 --- a/src/basic/fdset.c +++ b/src/basic/fdset.c @@ -44,7 +44,7 @@ FDSet *fdset_new(void) { return MAKE_FDSET(set_new(NULL)); } -int fdset_new_array(FDSet **ret, int *fds, unsigned n_fds) { +int fdset_new_array(FDSet **ret, const int *fds, unsigned n_fds) { unsigned i; FDSet *s; int r; diff --git a/src/basic/fdset.h b/src/basic/fdset.h index 340438d7c4..70d8acbcff 100644 --- a/src/basic/fdset.h +++ b/src/basic/fdset.h @@ -35,7 +35,7 @@ int fdset_consume(FDSet *s, int fd); bool fdset_contains(FDSet *s, int fd); int fdset_remove(FDSet *s, int fd); -int fdset_new_array(FDSet **ret, int *fds, unsigned n_fds); +int fdset_new_array(FDSet **ret, const int *fds, unsigned n_fds); int fdset_new_fill(FDSet **ret); int fdset_new_listen_fds(FDSet **ret, bool unset); |