commit:     95f7a7bd56f5cbb3fdcb5e28a7e2f776181e628b
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri May 13 12:05:58 2016 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri May 13 12:05:58 2016 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=95f7a7bd

sys-devel/binutils-config/ldwrapper: some better error reporting

 sys-devel/binutils-config/files/ldwrapper.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys-devel/binutils-config/files/ldwrapper.c 
b/sys-devel/binutils-config/files/ldwrapper.c
index 9823da8..a98b1e6 100644
--- a/sys-devel/binutils-config/files/ldwrapper.c
+++ b/sys-devel/binutils-config/files/ldwrapper.c
@@ -92,6 +92,7 @@ find_real_ld(char **ld, char verbose, char *wrapper)
        /* parse EPREFIX/etc/env.d/binutils/config-CHOST to get CURRENT, then
         * consider $EPREFIX/usr/CHOST/binutils-bin/CURRENT where we should
         * be able to find ld */
+       *e = '\0';
        if ((f = fopen(EPREFIX "/etc/env.d/binutils/config-" CHOST, "r")) != 
NULL) {
                char p[ESIZ];
                while (fgets(p, ESIZ, f) != NULL) {
@@ -115,10 +116,12 @@ find_real_ld(char **ld, char verbose, char *wrapper)
        }
        if (verbose)
                fprintf(stdout, "%s: linker not found via " EPREFIX
-                               "/etc/env.d/binutils/config-" CHOST "\n", 
wrapper);
+                               "/etc/env.d/binutils/config-" CHOST " 
(ld=%s)\n",
+                               wrapper, e);
        
        /* last try, call binutils-config to tell us what the linker is
         * supposed to be */
+       *e = '\0';
        if ((f = popen("binutils-config -c", "r")) != NULL) {
                char p[ESIZ];
                if (fgets(p, ESIZ, f) != NULL) {
@@ -134,8 +137,8 @@ find_real_ld(char **ld, char verbose, char *wrapper)
                }
        }
        if (verbose)
-               fprintf(stdout, "%s: linker not found via binutils-config -c\n",
-                               wrapper);
+               fprintf(stdout, "%s: linker not found via binutils-config -c 
(ld=%s)\n",
+                               wrapper, e);
 }
 
 int

Reply via email to