diff --git a/src/exec.c b/src/exec.c index 155eaf2d..14558500 100644 --- a/src/exec.c +++ b/src/exec.c @@ -38,6 +38,7 @@ #include "conf.h" #include "helpers.h" #include "sig.h" +#include "util.h" #include "utmp-api.h" #define NUM_ARGS 16 diff --git a/src/helpers.h b/src/helpers.h index 7c734d9f..e4fc1595 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -103,17 +103,6 @@ static inline int create(char *path, mode_t mode, uid_t uid, gid_t gid) return 0; } -/* paste dir/file into buf */ -static inline int paste(char *buf, size_t len, const char *dir, const char *file) -{ - if (!dir) - dir = ""; - if (!file) - file = ""; - - return snprintf(buf, len, "%s%s%s", dir, fisslashdir(dir) ? "" : "/", file); -} - int ismnt (char *file, char *dir, char *mode); int fismnt (char *dir); diff --git a/src/pid.h b/src/pid.h index 6bf96ce2..7f0bd0cb 100644 --- a/src/pid.h +++ b/src/pid.h @@ -26,6 +26,7 @@ #define FINIT_PID_H_ #include "svc.h" +#include "util.h" int pid_alive (pid_t pid); char *pid_get_name (pid_t pid, char *name, size_t len); diff --git a/src/util.h b/src/util.h index e65cd8c2..84c32379 100644 --- a/src/util.h +++ b/src/util.h @@ -31,6 +31,7 @@ #include #include #endif +#include #ifndef RB_SW_SUSPEND /* Since Linux 2.5.18, but not in GLIBC until 2.19 */ #define RB_SW_SUSPEND 0xd000fce2 @@ -64,6 +65,17 @@ static inline char *strterm(char *str, size_t len) return str; } +/* paste dir/file into buf */ +static inline int paste(char *buf, size_t len, const char *dir, const char *file) +{ + if (!dir) + dir = ""; + if (!file) + file = ""; + + return snprintf(buf, len, "%s%s%s", dir, fisslashdir(dir) ? "" : "/", file); +} + #endif /* FINIT_UTIL_H_ */ /**