From 14f61b44d0de6b4b967adfa69a7d78229a95e1c0 Mon Sep 17 00:00:00 2001 From: diamant3 Date: Sat, 15 Jun 2024 15:06:19 +0800 Subject: [PATCH] unnecessary check --- src/libcglue/glue.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/libcglue/glue.c b/src/libcglue/glue.c index d0371656..38dabe9e 100755 --- a/src/libcglue/glue.c +++ b/src/libcglue/glue.c @@ -1193,32 +1193,6 @@ char *realpath(const char *path, char *resolved_path) return NULL; } - /* check the length of every component of path arg */ - char component[NAME_MAX + 1]; - const char *start = path; - const char *end; - while (*start != '\0') { - end = start; - - // find the next '/' - while (*end != '/' && *end != '\0') { end++; } - - // compute path component length - size_t len = end - start; - if (len > NAME_MAX) { - errno = ENAMETOOLONG; - return NULL; - } - - // copy start to component buffer - memcpy(component, start, len); - component[len] = '\0'; - - // move to the next component - if (*end == '/') { start = end + 1; } - else { start = end; } - } - /* check if file or directory exist */ struct stat st; if (stat(path, &st) == 0) {