[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[groff] 03/03: src/libs/libgroff/relocate.cpp: Shift #ifdef.
From: |
G. Branden Robinson |
Subject: |
[groff] 03/03: src/libs/libgroff/relocate.cpp: Shift #ifdef. |
Date: |
Tue, 5 Jan 2021 23:55:39 -0500 (EST) |
gbranden pushed a commit to branch master
in repository groff.
commit 2fabd352f4ccdb382acffb7705a129977a2768d3
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Jan 6 15:48:39 2021 +1100
src/libs/libgroff/relocate.cpp: Shift #ifdef.
* src/libs/libgroff/relocate.cpp (set_current_prefix) [!_WIN32]: Move
logic attempting to set `curr_prefix` by calling searchpathext() from
here...
[WIN32]: ...to here. The PATHEXT environment variable has semantics
only under Windows, not POSIX systems, so the placement of this code
seemed erroneous.
---
ChangeLog | 5 +++++
src/libs/libgroff/relocate.cpp | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 75306ca..e3704cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,11 @@
searchpath() is used to populate `curr_prefix`, and that
function (except on Windows) performs its own allocation. Fixes
memory leak noted by Ingo Schwarze.
+ (set_current_prefix) [!_WIN32]: Move logic attempting to set
+ `curr_prefix` by calling searchpathext() from here...
+ [WIN32]: ...to here. The PATHEXT environment variable has
+ semantics only under Windows, not POSIX systems, so the
+ placement of this code seemed erroneous.
See <https://savannah.gnu.org/bugs/?55475>.
diff --git a/src/libs/libgroff/relocate.cpp b/src/libs/libgroff/relocate.cpp
index 298f693..6625e25 100644
--- a/src/libs/libgroff/relocate.cpp
+++ b/src/libs/libgroff/relocate.cpp
@@ -171,8 +171,6 @@ void set_current_prefix()
# if DEBUG
fprintf(stderr, "curr_prefix: %s\n", curr_prefix);
# endif /* DEBUG */
-#else /* !_WIN32 */
- curr_prefix = searchpath(program_name, getenv("PATH"));
if (!curr_prefix && !strchr(program_name, '.')) { // try with extensions
pathextstr = strsave(getenv("PATHEXT"));
if (!pathextstr)
@@ -180,6 +178,8 @@ void set_current_prefix()
curr_prefix = searchpathext(program_name, pathextstr, getenv("PATH"));
a_delete pathextstr;
}
+#else /* !_WIN32 */
+ curr_prefix = searchpath(program_name, getenv("PATH"));
if (!curr_prefix)
return;
#endif /* !_WIN32 */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [groff] 03/03: src/libs/libgroff/relocate.cpp: Shift #ifdef.,
G. Branden Robinson <=