summaryrefslogtreecommitdiff
path: root/minecctl/misc-commands.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-07-12 14:04:40 +0200
committerDavid Härdeman <david@hardeman.nu>2020-07-12 14:04:40 +0200
commit6586ea650597ae0563c4234a7658499ce1e0117b (patch)
treebe99b63c29a21b2492a35d0bc9cd2ade93388405 /minecctl/misc-commands.c
parent714c267f5e4af98fd986c3563fc0e8e82a3dae1f (diff)
Teach minecproxy to use same dirs as minecctl, step 1
Diffstat (limited to 'minecctl/misc-commands.c')
-rw-r--r--minecctl/misc-commands.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/minecctl/misc-commands.c b/minecctl/misc-commands.c
index db9b937..3ad9792 100644
--- a/minecctl/misc-commands.c
+++ b/minecctl/misc-commands.c
@@ -69,6 +69,7 @@ static bool write_cfg_file(int dfd, const char *name,
static bool find_user_service(int xfd, const char *service)
{
_cleanup_close_ int dfd = -1;
+ _cleanup_free_ char *dpath = NULL;
/* FIXME: Make this a macro, make paths #defines */
char sub_path[STRLEN("systemd/user/") + strlen(service) + 1];
char etc_path[STRLEN("/etc/systemd/user/") + strlen(service) + 1];
@@ -98,11 +99,11 @@ static bool find_user_service(int xfd, const char *service)
return true;
}
- dfd = open_xdg_data_dir(false);
+ dfd = open_xdg_data_dir(false, &dpath);
if (dfd >= 0) {
if (faccessat(dfd, sub_path, R_OK, 0) == 0) {
info("User service %s already installed in "
- "$XDG_DATA_HOME/systemd/user/", service);
+ "%s/systemd/user/", service, dpath);
return true;
}
}
@@ -187,7 +188,7 @@ bool do_init(_unused_ struct cfg *cfg)
_cleanup_close_ int xdfd = -1;
_cleanup_close_ int mdfd = -1;
- xcfd = open_xdg_cfg_dir(true);
+ xcfd = open_xdg_cfg_dir(true, NULL);
if (xcfd < 0)
return false;
@@ -215,7 +216,7 @@ bool do_init(_unused_ struct cfg *cfg)
___examples_minecproxy_service_len))
return false;
- xdfd = open_xdg_data_dir(true);
+ xdfd = open_xdg_data_dir(true, NULL);
if (xdfd < 0)
return false;