mirror of
https://git.freebsd.org/ports.git
synced 2025-06-06 21:30:31 -04:00
Patch introduced in r493861 to fix segfault on FreeBSD 12+ broke it on FreeBSD 11. This new version fixes it on both versions. While here, pet portlint a bit moving USES to proper place and removing RUN_DEPENDS := BUILD_DEPENDS adding individual run depends where it's necessary. PR: 235810 Submitted by: Stewart Morgan <stewart.morgan@gmail.com> Sponsored by: Rubicon Communications, LLC (Netgate)
27 lines
706 B
C
27 lines
706 B
C
--- helper.c.orig 2010-09-08 05:58:11 UTC
|
|
+++ helper.c
|
|
@@ -323,16 +323,22 @@ int valid_arg_vector(char **av)
|
|
char *substitute_known_path(char *request)
|
|
{
|
|
cmd_t *cmd=commands;
|
|
- char *stripped_req=strdup(basename(request));
|
|
+ char *mrequest=strdup(request);
|
|
+ char *stripped_req=strdup(basename(mrequest));
|
|
+ free(mrequest);
|
|
while (cmd != NULL)
|
|
{
|
|
+ char *mname;
|
|
if (cmd->name == NULL)
|
|
break;
|
|
- if (exact_match(basename(cmd->name),stripped_req))
|
|
+ mname = strdup(cmd->name);
|
|
+ if (exact_match(basename(mname),stripped_req))
|
|
{
|
|
free(stripped_req); /* discard old pathname */
|
|
+ free(mname);
|
|
return (strdup(cmd->name));
|
|
}
|
|
+ free(mname);
|
|
cmd++;
|
|
}
|
|
return (stripped_req);
|