diff options
| author | Alejandro Colomar <alx@kernel.org> | 2024-04-22 22:47:27 +0200 |
|---|---|---|
| committer | Alejandro Colomar <alx@kernel.org> | 2024-06-18 22:59:45 +0200 |
| commit | eca38349cb25ccae89acf3a0dc4dfd9a6ca8770c (patch) | |
| tree | 4148dd7038e38d04f8d9436d5b8b909a0ef7851c /src/nxt_fs.c | |
| parent | a9aed2044c6191b93af0199aa77b26ab39cbbad2 (diff) | |
| download | unit-eca38349cb25ccae89acf3a0dc4dfd9a6ca8770c.tar.gz unit-eca38349cb25ccae89acf3a0dc4dfd9a6ca8770c.tar.bz2 | |
fs: Make the full directory path for the pid file and the control socket
Build systems should not attempt to create $runstatedir (or anything
under it). Doing so causes warnings in packaging systems, such as in
Alpine Linux, as reported by Andy.
But unitd(8) can be configured to be installed under /opt, or other
trees, where no directories exist before hand. Expecting that the user
creates the entire directory trees that unit will need is a bit
unreasonable. Instead, let's just create any directories that we need,
with all their parents, at run time.
Fixes: 57fc9201cb91 ("Socket: Created control socket & pid file directories.")
Link: <https://github.com/nginx/unit/issues/742>
Reported-by: Andy Postnikov <apostnikov@gmail.com>
Tested-by: Andy Postnikov <apostnikov@gmail.com>
Tested-by: Andrew Clayton <a.clayton@nginx.com>
Reviewed-by: Andrew Clayton <a.clayton@nginx.com>
Acked-by: Konstantin Pavlov <thresh@nginx.com>
Cc: Liam Crilly <liam@nginx.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Diffstat (limited to 'src/nxt_fs.c')
| -rw-r--r-- | src/nxt_fs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nxt_fs.c b/src/nxt_fs.c index 788c3ee2..8ea8e186 100644 --- a/src/nxt_fs.c +++ b/src/nxt_fs.c @@ -46,7 +46,7 @@ nxt_fs_mkdir_p(const u_char *dir, mode_t mode) nxt_int_t -nxt_fs_mkdir_dirname(const u_char *path, mode_t mode) +nxt_fs_mkdir_p_dirname(const u_char *path, mode_t mode) { char *ptr, *dir; nxt_int_t ret; @@ -64,7 +64,7 @@ nxt_fs_mkdir_dirname(const u_char *path, mode_t mode) } *ptr = '\0'; - ret = nxt_fs_mkdir((const u_char *) dir, mode); + ret = nxt_fs_mkdir_p((const u_char *) dir, mode); out_free: nxt_free(dir); |
