]> Savannah Git Hosting - gnulib.git/commitdiff
findprog-lgpl: Fix link error (existing since 2008-09-02).
authorBruno Haible <bruno@clisp.org>
Sat, 16 May 2020 15:19:42 +0000 (17:19 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 16 May 2020 15:19:42 +0000 (17:19 +0200)
* 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.

ChangeLog
lib/findprog.c
modules/findprog-lgpl

index 67af0d448994bea066c500dd33ac6477bc9bc1c1..889c756ebaae80cf8c4d774bd3ff0f441f137180 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-05-16  Bruno Haible  <bruno@clisp.org>
+
+       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  <eggert@cs.ucla.edu>
 
        c-stack: pacify -Wunused-result when DEBUG
index b562e9da6ad9ac35ca6244ae689f644c135ab195..fb76417064c8d9f25172d080029be41808f2e73e 100644 (file)
@@ -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);
index 3c56f0245da6d8848af5f1b7dee52622168077c0..658183de4ee9adf29d3a3ba73072e42c215f53ef 100644 (file)
@@ -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"