Skip to content

Commit d04b512

Browse files
committed
Fix discarted qualifiers warning
Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
1 parent 8af39ad commit d04b512

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/librc/librc.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,8 @@ rc_sys(void)
370370
char *
371371
rc_sysconfdir_get(void) {
372372
static char path[PATH_MAX] = { 0 };
373-
if (geteuid() != 0) {
374-
if (!*path) {
373+
if (!*path) {
374+
if (geteuid() != 0) {
375375
char *config_path;
376376
if ((config_path = getenv("XDG_CONFIG_HOME"))) {
377377
snprintf(path, PATH_MAX, "%s", config_path);
@@ -380,18 +380,18 @@ rc_sysconfdir_get(void) {
380380
} else {
381381
exit(1);
382382
}
383+
} else {
384+
snprintf(path, PATH_MAX, "%s", RC_SYSCONFDIR);
383385
}
384-
return path;
385-
} else {
386-
return RC_SYSCONFDIR;
387386
}
387+
return path;
388388
}
389389

390390
char *
391391
rc_svcdir_get(void) {
392392
static char path[PATH_MAX] = { 0 };
393-
if (geteuid() != 0) {
394-
if (!*path) {
393+
if (!*path) {
394+
if (geteuid() != 0) {
395395
char *config_path;
396396
if ((config_path = getenv("XDG_RUNTIME_DIR")) ||
397397
(config_path = getenv("XDG_DATA_HOME"))) {
@@ -402,11 +402,11 @@ rc_svcdir_get(void) {
402402
} else {
403403
exit(1);
404404
}
405+
} else {
406+
snprintf(path, PATH_MAX, "%s", RC_SVCDIR);
405407
}
406-
return path;
407-
} else {
408-
return RC_SVCDIR;
409408
}
409+
return path;
410410
}
411411

412412
char *

src/librc/rc.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ char *rc_initdir_get(void);
133133
char *rc_confdir_get(void);
134134
char *rc_svcdir_get(void);
135135
char *rc_runtimedir_get(void);
136+
char *rc_runleveldir_get(void);
136137

137138
/*! Return the current runlevel.
138139
* @return the current runlevel */

0 commit comments

Comments
 (0)