[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
findprog-lgpl: fix link error
From: |
Bruno Haible |
Subject: |
findprog-lgpl: fix link error |
Date: |
Sat, 16 May 2020 17:24:35 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-177-generic; KDE/5.18.0; x86_64; ; ) |
The module 'findprog-lgpl' is pretty broken, since it was introduced on
2008-09-02:
- It never produces any code.
- When used together with the module 'findprog', that module produces no code
either.
In both cases, a link error regarding the symbol 'find_in_path' results.
This patch fixes it.
2020-05-16 Bruno Haible <address@hidden>
findprog-lgpl: Fix link error (existing since 2008-09-02).
* modules/findprog-lgpl (Makefile.am): Arrange to compile
findprog-lgpl.c, not findprog.c.
* lib/findprog.c (find_in_path): Add LGPLed replacement code for
XNMALLOC.
diff --git a/lib/findprog.c b/lib/findprog.c
index b562e9d..fb76417 100644
--- a/lib/findprog.c
+++ b/lib/findprog.c
@@ -122,7 +122,17 @@ find_in_path (const char *progname)
/* Add the "./" prefix for real, that
xconcatenated_filename()
optimized away. This avoids a second PATH search when the
caller uses execlp/execvp. */
+# if !IN_FINDPROG_LGPL
progpathname = XNMALLOC (2 + strlen (progname) + 1, char);
+# else
+ progpathname = (char *) malloc (2 + strlen (progname) + 1);
+ if (progpathname == NULL)
+ {
+ /* Out of memory. */
+ free (path);
+ return progname;
+ }
+# endif
progpathname[0] = '.';
progpathname[1] = '/';
memcpy (progpathname + 2, progname, strlen (progname) + 1);
diff --git a/modules/findprog-lgpl b/modules/findprog-lgpl
index 3c56f02..658183d 100644
--- a/modules/findprog-lgpl
+++ b/modules/findprog-lgpl
@@ -22,7 +22,7 @@ gl_FINDPROG
gl_MODULE_INDICATOR([findprog-lgpl])
Makefile.am:
-lib_SOURCES += findprog.h findprog.c
+lib_SOURCES += findprog.h findprog-lgpl.c
Include:
"findprog.h"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- findprog-lgpl: fix link error,
Bruno Haible <=