From 722c59a2d3af78a4291b335350be7bdfec375294 Mon Sep 17 00:00:00 2001 From: anna Date: Fri, 20 Jan 2023 08:49:33 -0300 Subject: [PATCH] Fix discarted qualifiers warning Signed-off-by: anna --- src/librc/librc.c | 20 ++++++++++---------- src/librc/rc.h.in | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/librc/librc.c b/src/librc/librc.c index 61494310a..f87ac680b 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -353,8 +353,8 @@ rc_sys(void) char * rc_sysconfdir_get(void) { static char path[PATH_MAX] = { 0 }; - if (geteuid() != 0) { - if (!*path) { + if (!*path) { + if (geteuid() != 0) { char *config_path; if ((config_path = getenv("XDG_CONFIG_HOME"))) { snprintf(path, PATH_MAX, "%s", config_path); @@ -363,18 +363,18 @@ rc_sysconfdir_get(void) { } else { exit(1); } + } else { + snprintf(path, PATH_MAX, "%s", RC_SYSCONFDIR); } - return path; - } else { - return RC_SYSCONFDIR; } + return path; } char * rc_svcdir_get(void) { static char path[PATH_MAX] = { 0 }; - if (geteuid() != 0) { - if (!*path) { + if (!*path) { + if (geteuid() != 0) { char *config_path; if ((config_path = getenv("XDG_RUNTIME_DIR")) || (config_path = getenv("XDG_DATA_HOME"))) { @@ -385,11 +385,11 @@ rc_svcdir_get(void) { } else { exit(1); } + } else { + snprintf(path, PATH_MAX, "%s", RC_SVCDIR); } - return path; - } else { - return RC_SVCDIR; } + return path; } char * diff --git a/src/librc/rc.h.in b/src/librc/rc.h.in index e207ed22a..853105c54 100644 --- a/src/librc/rc.h.in +++ b/src/librc/rc.h.in @@ -133,6 +133,7 @@ char *rc_initdir_get(void); char *rc_confdir_get(void); char *rc_svcdir_get(void); char *rc_runtimedir_get(void); +char *rc_runleveldir_get(void); /*! Return the current runlevel. * @return the current runlevel */