From: Bruno Haible Date: Sat, 16 May 2020 15:19:42 +0000 (+0200) Subject: findprog-lgpl: Fix link error (existing since 2008-09-02). X-Git-Tag: v1.0~4095 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=e257a3f19bd193d73aca4a6d80af56fa85877395;p=gnulib.git 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/ChangeLog b/ChangeLog index 67af0d4489..889c756eba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2020-05-16 Bruno Haible + + 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. + 2020-05-15 Paul Eggert c-stack: pacify -Wunused-result when DEBUG diff --git a/lib/findprog.c b/lib/findprog.c index b562e9da6a..fb76417064 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 3c56f0245d..658183de4e 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"