Add build option to allow hardlink tools

This commit is contained in:
Andrea Mazzoleni 2026-05-30 17:30:21 +02:00
parent fdadb443ad
commit 68525d6fa5
3 changed files with 14 additions and 2 deletions

View file

@ -34,8 +34,9 @@ SnapRAID HISTORY
build time. When not specified, the existing runtime discovery
behaviour is preserved. Primarily intended for NixOS and other
non-FHS systems.
* Added --enable-symlink-tools configure option to allow the validation
logic to accept symbolic links for the specified --with-* paths.
* Added --enable-symlink-tools and --enable-hardlink-tools configure
options to allow the validation logic to accept symbolic and hard
links for the specified --with-* paths.
14.6 2026/06
============

View file

@ -262,12 +262,14 @@ static int verify_executable(const char* exec_path, char* resolved_path)
return -1;
}
#if !HAVE_HARDLINK_TOOLS
/* verify the file has not been hardlinked multiple times */
if (st.st_nlink > 1) {
log_error(EINVAL, "File %s has multiple hard links", resolved_path);
close(fd);
return -1;
}
#endif
return fd;
}

View file

@ -406,6 +406,15 @@ AC_ARG_ENABLE([symlink-tools],
])
])
# Enable support for hardlinked tool paths
AC_ARG_ENABLE([hardlink-tools],
[AS_HELP_STRING([--enable-hardlink-tools], [allow paths specified with --with-* options to be hard links])],
[
AS_IF([test "x$enableval" = "xyes"], [
AC_DEFINE([HAVE_HARDLINK_TOOLS], [1], [Define to 1 if paths specified with --with-* options are allowed to be hardlinks.])
])
])
AC_ARG_VAR([TESTENV], [Test environment])
AC_ARG_VAR([FAILENV], [Test environment for failing tests])
AC_ARG_VAR([TESTENV_SSE2], [Test environment for SSE2])