aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs6f/s6f_user_get_confdirs.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2025-06-14 13:43:29 +0000
committerLaurent Bercot <ska@appnovation.com>2025-06-14 13:43:29 +0000
commit83622b9b37821cccab3c535209200b9ccd2ba6a3 (patch)
treef4fb35731cfe86c0da70bbddf9a153a2da135a51 /src/libs6f/s6f_user_get_confdirs.c
parent331d019eeb1104d4baa6af1d11ad228793b8d97f (diff)
downloads6-frontend-83622b9b37821cccab3c535209200b9ccd2ba6a3.tar.gz
Actually include it in the build >.>
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libs6f/s6f_user_get_confdirs.c')
-rw-r--r--src/libs6f/s6f_user_get_confdirs.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/libs6f/s6f_user_get_confdirs.c b/src/libs6f/s6f_user_get_confdirs.c
index 57e6451..badbea0 100644
--- a/src/libs6f/s6f_user_get_confdirs.c
+++ b/src/libs6f/s6f_user_get_confdirs.c
@@ -10,7 +10,7 @@
#include <skalibs/strerr.h>
#include <skalibs/stralloc.h>
-#include "s6-internal.h"
+#include "s6f.h"
#define dienomem() strerr_diefu1sys(111, "allocate memory")
@@ -27,9 +27,10 @@ void s6f_user_get_confdirs (s6f_confdirs *dirs, stralloc *storage)
if (!datahome || !confighome)
{
- *home = getenv("HOME") ;
+ home = getenv("HOME") ;
if (!home)
{
+ uid_t uid = getuid() ;
errno = 0 ;
pw = getpwuid(uid) ;
if (!pw)
@@ -46,7 +47,7 @@ void s6f_user_get_confdirs (s6f_confdirs *dirs, stralloc *storage)
if (homelen)
{
memcpy(homeinstack, pw->pw_dir, homelen) ;
- homestack[homelen] = 0 ;
+ homeinstack[homelen] = 0 ;
home = homeinstack ;
}
@@ -60,18 +61,20 @@ void s6f_user_get_confdirs (s6f_confdirs *dirs, stralloc *storage)
|| !stralloc_cats(storage, "/s6-rc")
|| !stralloc_0(storage)) dienomem() ;
- repopos = storage.len ;
+ repopos = storage->len ;
if (!(datahome ? stralloc_cats(storage, datahome) : stralloc_cats(storage, home) && stralloc_cats(storage, "/.local/share"))
|| !stralloc_cats(storage, "/s6-frontend/repository")
- || !stralloc_0(storage)) dienomem ;
+ || !stralloc_0(storage)) dienomem() ;
- bootpos = storage.len ;
+ bootpos = storage->len ;
if (!(confighome ? stralloc_cats(storage, confighome) : stralloc_cats(storage, home) && stralloc_cats(storage, "/.config"))
|| !stralloc_cats(storage, "/s6-rc")
- || !stralloc_0(storage)) dienomem ;
+ || !stralloc_0(storage)) dienomem() ;
/* Don't add to storage past this point */
- dirs->scan = storage.s + scanpos ;
-
+ dirs->scan = storage->s + scanpos ;
+ dirs->live = storage->s + livepos ;
+ dirs->repo = storage->s + repopos ;
+ dirs->boot = storage->s + bootpos ;
}