From c1553bd5d64ae783f26969d2c1de67b6a4fbea37 Mon Sep 17 00:00:00 2001 From: TapTap Date: Thu, 17 Sep 2026 01:31:19 +0200 Subject: [PATCH] style(delete): simplify redundant root[0] check (cppcheck) --- src/shared/file_receive.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/shared/file_receive.c b/src/shared/file_receive.c index 6794ed9..c9f9c18 100644 --- a/src/shared/file_receive.c +++ b/src/shared/file_receive.c @@ -3172,9 +3172,10 @@ char* file_receive_basis_delete_relative(const Config* config, const char* path) root_len--; if (strncmp(path, root, root_len) != 0) return NULL; - if (root_len == 1 && root[0] == '/') { - /* The receive root is "/": every absolute path is below it, and the child - relative form is everything after the leading '/'. */ + if (root_len == 1) { + /* `root` is "/" (the only single-character absolute root): every absolute + path is below it, and the child relative form is everything after the + leading '/'. */ if (path[1] == '\0') return NULL; /* identical to the root, not a child */ return str_dup(path + 1);