diff --git a/HISTORY b/HISTORY index e9111c6f..3779ef01 100644 --- a/HISTORY +++ b/HISTORY @@ -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 ============ diff --git a/cmdline/unix.c b/cmdline/unix.c index 910216c4..f4e6253d 100644 --- a/cmdline/unix.c +++ b/cmdline/unix.c @@ -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; } diff --git a/configure.ac b/configure.ac index 2c1da3e5..598fbcc1 100644 --- a/configure.ac +++ b/configure.ac @@ -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])