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 1Rgdzi-0003BP-Io for garchives@archives.gentoo.org; Fri, 30 Dec 2011 15:03:42 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8CE3521C04E; Fri, 30 Dec 2011 15:03:34 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 5AA4E21C04E for ; Fri, 30 Dec 2011 15:03:34 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CE83B1B4004 for ; Fri, 30 Dec 2011 15:03:33 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 1DBEB80043 for ; Fri, 30 Dec 2011 15:03:33 +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: <0d6ae379f43fdab9516e6ed949ba9563972c0c65.idl0r@gentoo> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/rc.c X-VCS-Directories: src/rc/ X-VCS-Committer: idl0r X-VCS-Committer-Name: Christian Ruppert X-VCS-Revision: 0d6ae379f43fdab9516e6ed949ba9563972c0c65 Date: Fri, 30 Dec 2011 15:03:33 +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: b411e36d-c0d4-4a98-86c1-3305941e3a52 X-Archives-Hash: 7e3ce254d3bf4c6c6a199a6c4d81696c commit: 0d6ae379f43fdab9516e6ed949ba9563972c0c65 Author: Christian Ruppert gentoo org> AuthorDate: Fri Dec 30 00:44:15 2011 +0000 Commit: Christian Ruppert gentoo org> CommitDate: Fri Dec 30 15:03:24 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3D0d6ae379 Compare stricter in proc_getent The new proc_getent compares stricter so that e.g. "ro" doesn't match root=3D/dev/sdaN anymore. So it has to be either "ro" or "ro=3D". --- src/rc/rc.c | 27 ++++++++++++++++++--------- 1 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/rc/rc.c b/src/rc/rc.c index ad16f7d..05c99fa 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -173,7 +173,7 @@ proc_getent(const char *ent) { FILE *fp; char *proc, *p, *value =3D NULL; - size_t i; + size_t i, len; =20 if (!exists("/proc/cmdline")) return NULL; @@ -187,16 +187,25 @@ proc_getent(const char *ent) i =3D 0; if (rc_getline(&proc, &i, fp) =3D=3D -1 || proc =3D=3D NULL) eerror("rc_getline: %s", strerror(errno)); - if (*proc && (p =3D strstr(proc, ent))) { - i =3D p - proc; - if (i =3D=3D '\0' || proc[i - 1] =3D=3D ' ') { - p +=3D strlen(ent); - if (*p =3D=3D '=3D') - p++; - value =3D xstrdup(strsep(&p, " ")); + + if(proc !=3D NULL) { + len =3D strlen(ent); + + while((p =3D strsep(&proc, " "))) { + if(strncmp(ent, p, len) =3D=3D 0 && (p[len] =3D=3D '\0' || p[len] =3D= =3D ' ' || p[len] =3D=3D '=3D')) { + p +=3D len; + + if (*p =3D=3D '=3D') + p++; + + value =3D xstrdup(p); + } } - } else + } + + if(!value) errno =3D ENOENT; + fclose(fp); free(proc); =20