aboutsummaryrefslogtreecommitdiff
path: root/src/rc/rc-misc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-03-26 15:10:26 +0000
committerRoy Marples <roy@marples.name>2008-03-26 15:10:26 +0000
commitcee3ccc4c10e8ba0d1635dd95d8e491435d130bc (patch)
treeacd59a491467d86d5f9a909a7fab02b64c20a0d4 /src/rc/rc-misc.c
parentf90f2914b927d303d219fb2862f0dbf868be17a3 (diff)
Fix a segfault if rc.conf does not exist, Gentoo #214887
Diffstat (limited to 'src/rc/rc-misc.c')
-rw-r--r--src/rc/rc-misc.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c
index e802ee4f..42d9e532 100644
--- a/src/rc/rc-misc.c
+++ b/src/rc/rc-misc.c
@@ -79,20 +79,24 @@ char *rc_conf_value(const char *setting)
if (exists(RC_CONF_OLD)) {
old = rc_config_load(RC_CONF_OLD);
if (old) {
- TAILQ_CONCAT(rc_conf, old, entries);
- free(old);
+ if (rc_conf) {
+ TAILQ_CONCAT(rc_conf, old, entries);
+ free(old);
+ } else
+ rc_conf = old;
}
}
/* Convert old uppercase to lowercase */
- TAILQ_FOREACH(s, rc_conf, entries) {
- p = s->value;
- while (p && *p && *p != '=') {
- if (isupper((int) *p))
- *p = tolower((int) *p);
- p++;
+ if (rc_conf)
+ TAILQ_FOREACH(s, rc_conf, entries) {
+ p = s->value;
+ while (p && *p && *p != '=') {
+ if (isupper((int) *p))
+ *p = tolower((int) *p);
+ p++;
+ }
}
- }
}
return rc_config_value(rc_conf, setting);