Skip to content

Commit

Permalink
Only provide execvpe(3) when needed
Browse files Browse the repository at this point in the history
Check for the existence of execvpe(3) and only provide the FreeBSD
compat version if required.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by:	Brooks Davis <brooks.davis@sri.com>
Closes openzfs#15609
  • Loading branch information
brooksdavis authored and tonyhutter committed Jul 17, 2024
1 parent 32cd2da commit 5668411
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/user.m4
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV
ZFS_AC_CONFIG_USER_ZFSEXEC
AC_CHECK_FUNCS([issetugid mlockall strlcat strlcpy])
AC_CHECK_FUNCS([execvpe issetugid mlockall strlcat strlcpy])
AC_SUBST(RM)
])
2 changes: 2 additions & 0 deletions lib/libspl/include/os/freebsd/sys/param.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
extern size_t spl_pagesize(void);
#define PAGESIZE (spl_pagesize())

#ifndef HAVE_EXECVPE
extern int execvpe(const char *name, char * const argv[], char * const envp[]);
#endif

#endif
4 changes: 3 additions & 1 deletion lib/libzfs/os/freebsd/libzfs_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
#define ZFS_KMOD "openzfs"
#endif


#ifndef HAVE_EXECVPE
/* FreeBSD prior to 15 lacks execvpe */
static int
execvPe(const char *name, const char *path, char * const *argv,
char * const *envp)
Expand Down Expand Up @@ -192,6 +193,7 @@ execvpe(const char *name, char * const argv[], char * const envp[])

return (execvPe(name, path, argv, envp));
}
#endif /* !HAVE_EXECVPE */

static __thread char errbuf[ERRBUFLEN];

Expand Down

0 comments on commit 5668411

Please sign in to comment.