From 978d812153736c06763192f0f1d4b34e54ad633f Mon Sep 17 00:00:00 2001 From: saladpanda <4498831+saladpanda@users.noreply.github.com> Date: Fri, 20 Oct 2023 10:24:54 +0200 Subject: [PATCH] Fix error when configuring a contentfile in / (#18) When using this config line: content /snapraid.content SnapRAID throws this error: Error accessing 'content' dir '' specification in '/etc/snapraid.conf' at line 17 This commit fixes that by not replacing the rightmost slash with NUL but instead the char immediately after the slash. --- cmdline/state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdline/state.c b/cmdline/state.c index e8333a0f..d69a1777 100644 --- a/cmdline/state.c +++ b/cmdline/state.c @@ -855,7 +855,7 @@ void state_config(struct snapraid_state* state, const char* path, const char* co pathimport(device, sizeof(device), buffer); slash = strrchr(device, '/'); if (slash) - *slash = 0; + *(slash + 1) = 0; else pathcpy(device, sizeof(device), "."); if (stat(device, &st) == 0) {