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.
This commit is contained in:
saladpanda 2023-10-20 10:24:54 +02:00 • committed by GitHub
parent aa04edeccc
commit 978d812153
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {