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 1QOalL-0000oN-O8 for garchives@archives.gentoo.org; Mon, 23 May 2011 19:26:00 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D5ACB1C049; Mon, 23 May 2011 19:25:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id A81BE1C049 for ; Mon, 23 May 2011 19:25:51 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3CB151B402B for ; Mon, 23 May 2011 19:25:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 6B2F980505 for ; Mon, 23 May 2011 19:25:50 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/runscript.c X-VCS-Directories: src/rc/ X-VCS-Committer: williamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: d59e245bc7edc05e5d7a77df25717029b0710c55 Date: Mon, 23 May 2011 19:25:50 +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: 77a46328e33d77fab5438faac0489158 commit: d59e245bc7edc05e5d7a77df25717029b0710c55 Author: Christian Ruppert gentoo org> AuthorDate: Mon May 23 18:15:15 2011 +0000 Commit: William Hubbs gentoo org> CommitDate: Mon May 23 19:23:15 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3Dd59e245b Fix dirname calls in runscript runscript will try to get the dir and basename of a file/link in case it contains at least one slash. This patch gives a temporary copy of the pat= h to the dirname() function since dirname() can modify its argument. --- src/rc/runscript.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/rc/runscript.c b/src/rc/runscript.c index 0eca487..58eb609 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -1101,7 +1101,8 @@ runscript(int argc, char **argv) bool doneone =3D false; int retval, opt, depoptions =3D RC_DEP_TRACE; RC_STRING *svc; - char path[PATH_MAX], lnk[PATH_MAX], *dir, *save =3D NULL, pidstr[10]; + char path[PATH_MAX], lnk[PATH_MAX], *dir, *save =3D NULL, *save2 =3D NU= LL; + char pidstr[10]; size_t l =3D 0, ll; const char *file; struct stat stbuf; @@ -1133,7 +1134,8 @@ runscript(int argc, char **argv) dir =3D dirname(path); if (strchr(lnk, '/')) { save =3D xstrdup(dir); - dir =3D dirname(lnk); + save2 =3D xstrdup(lnk); + dir =3D dirname(save2); if (strcmp(dir, save) =3D=3D 0) file =3D basename_c(argv[1]); else @@ -1149,6 +1151,7 @@ runscript(int argc, char **argv) service =3D xstrdup(lnk); } free(save); + free(save2); } if (!service) service =3D xstrdup(path);