From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QfesN-00088K-Mv for garchives@archives.gentoo.org; Sat, 09 Jul 2011 21:15:48 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 432E421C17D; Sat, 9 Jul 2011 21:15:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id F0AF021C17D for ; Sat, 9 Jul 2011 21:15:39 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7801A1B4064 for ; Sat, 9 Jul 2011 21:15:39 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id A4CF18003D for ; Sat, 9 Jul 2011 21:15:38 +0000 (UTC) From: "Christian Ruppert" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Christian Ruppert" Message-ID: Subject: [gentoo-commits] proj/openrc:master commit in: src/librc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/librc/librc-misc.c X-VCS-Directories: src/librc/ X-VCS-Committer: idl0r X-VCS-Committer-Name: Christian Ruppert X-VCS-Revision: ef22868f3668fe833cdf297e619afe5b721f7716 Date: Sat, 9 Jul 2011 21:15:38 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: ce55aa293861a07fc251a783197fea78 commit: ef22868f3668fe833cdf297e619afe5b721f7716 Author: Christian Ruppert gentoo org> AuthorDate: Sat Jul 9 21:05:11 2011 +0000 Commit: Christian Ruppert gentoo org> CommitDate: Sat Jul 9 21:15:16 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3Def22868f Do not skip similar config options OpenRC goes through the config and checks each option for duplicates. Lets say we're on "rc_logger" currently and its the last option in the co= nfig file and we previously defined rc_logger_path. It now goes through all previous config options and compares those agains= t the current one "rc_logger" *but* it compares only the first N bytes, in this case strlen("rc_logger"). So it strips the _path from "rc_logger_path" wh= ich ends up into "rc_logger" and it compares that against the current one (al= so "rc_logger"), it would then simply override the previous definition. This patch fixes this behaviour to always compare the full option / varia= ble names. --- src/librc/librc-misc.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c index 15105c5..7244dee 100644 --- a/src/librc/librc-misc.c +++ b/src/librc/librc-misc.c @@ -173,10 +173,8 @@ rc_config_load(const char *file) /* In shells the last item takes precedence, so we need to remove any prior values we may already have */ TAILQ_FOREACH(cline, config, entries) { - p =3D strchr(cline->value, '=3D'); - if (p && strncmp(entry, cline->value, - (size_t)(p - cline->value)) =3D=3D 0) - { + i =3D strlen(entry); + if (strncmp(entry, cline->value, i) =3D=3D 0 && cline->value[i] =3D=3D= '=3D') { /* We have a match now - to save time we directly replace it */ free(cline->value); cline->value =3D newline; @@ -202,15 +200,13 @@ rc_config_value(RC_STRINGLIST *list, const char *en= try) { RC_STRING *line; char *p; - size_t len, dif; + size_t len; =20 len =3D strlen(entry); TAILQ_FOREACH(line, list, entries) { p =3D strchr(line->value, '=3D'); if (p !=3D NULL) { - dif =3D (p - line->value); - if (dif =3D=3D len && - strncmp(entry, line->value, dif) =3D=3D 0) + if (strncmp(entry, line->value, len) =3D=3D 0 && line->value[len] =3D= =3D '=3D') return ++p; } }