From: "Michael Haubenwallner" <haubi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/
Date: Mon, 18 Apr 2016 08:07:01 +0000 (UTC) [thread overview]
Message-ID: <1460966760.1f90d833970f8f6813a48f9385c234e197c3ee55.haubi@gentoo> (raw)
commit: 1f90d833970f8f6813a48f9385c234e197c3ee55
Author: Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer <DOT> com>
AuthorDate: Fri Apr 15 09:07:19 2016 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Apr 18 08:06:00 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=1f90d833
ldwrapper.c: check last PATH env entry; restore PATH env value; fix missing string.h warnings
sys-devel/binutils-config/files/ldwrapper.c | 36 ++++++++++++++---------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/sys-devel/binutils-config/files/ldwrapper.c b/sys-devel/binutils-config/files/ldwrapper.c
index 958bed4..9823da8 100644
--- a/sys-devel/binutils-config/files/ldwrapper.c
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
+#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#include <errno.h>
@@ -46,6 +47,9 @@ find_real_ld(char **ld, char verbose, char *wrapper)
char *e;
struct stat lde;
+ /* we may not succeed finding the linker */
+ *ld = NULL;
+
/* respect the override in environment */
ldoveride = getenv("BINUTILS_CONFIG_LD");
if (ldoveride != NULL && *ldoveride != '\0') {
@@ -67,23 +71,20 @@ find_real_ld(char **ld, char verbose, char *wrapper)
/* find ld in PATH, allowing easy PATH overrides */
path = getenv("PATH");
- if (path != NULL && *path != '\0') {
- char *p;
- char *q;
-
- for (p = path; (q = strchr(p, ':')) != NULL; p = q + 1) {
- if (q)
- *q = '\0';
- if (strstr(p, "/" CHOST "/binutils-bin/") != NULL) {
- snprintf(e, ESIZ, "%s/%s", p, wrapper);
- if (stat(e, &lde) == 0) {
- *ld = e;
- return;
- }
- }
- if (!q)
- break;
+ while (path > (char*)1 && *path != '\0') {
+ char *q = strchr(path, ':');
+ if (q)
+ *q = '\0';
+ if (strstr(path, "/" CHOST "/binutils-bin/") != NULL) {
+ snprintf(e, ESIZ, "%s/%s", path, wrapper);
+ if (stat(e, &lde) == 0)
+ *ld = e;
}
+ if (q)
+ *q = ':'; /* restore PATH value */
+ if (*ld)
+ return;
+ path = q + 1;
}
if (verbose)
fprintf(stdout, "%s: linker not found in PATH\n", wrapper);
@@ -135,9 +136,6 @@ find_real_ld(char **ld, char verbose, char *wrapper)
if (verbose)
fprintf(stdout, "%s: linker not found via binutils-config -c\n",
wrapper);
-
- /* we didn't succeed finding the linker */
- *ld = NULL;
}
int
next reply other threads:[~2016-04-18 8:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 8:07 Michael Haubenwallner [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-01-13 14:29 [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/binutils-config/files/ Fabian Groffen
2023-09-26 19:38 Fabian Groffen
2020-11-27 13:57 Fabian Groffen
2020-11-27 13:39 Fabian Groffen
2018-01-31 9:50 Fabian Groffen
2017-12-29 14:56 Fabian Groffen
2017-12-27 9:05 Fabian Groffen
2017-12-25 19:47 Fabian Groffen
2017-11-29 15:21 Fabian Groffen
2017-11-25 18:33 Fabian Groffen
2016-05-15 16:44 Fabian Groffen
2016-05-13 12:14 Fabian Groffen
2016-05-13 12:14 Fabian Groffen
2016-05-13 12:14 Fabian Groffen
2016-02-15 14:30 Fabian Groffen
2016-02-14 14:56 Fabian Groffen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460966760.1f90d833970f8f6813a48f9385c234e197c3ee55.haubi@gentoo \
--to=haubi@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox