mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-10-03 16:51:27 +00:00
unnecessary check
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user