static void rtems_ftpfs_eval_path( rtems_filesystem_eval_path_context_t *self ) { rtems_filesystem_eval_path_eat_delimiter(self); if (rtems_filesystem_eval_path_has_path(self)) { const char *path = rtems_filesystem_eval_path_get_path(self); size_t pathlen = rtems_filesystem_eval_path_get_pathlen(self); char *pathdup = malloc(pathlen + 1); rtems_filesystem_eval_path_clear_path(self); if (pathdup != NULL) { rtems_filesystem_location_info_t *currentloc = rtems_filesystem_eval_path_get_currentloc(self); memcpy(pathdup, path, pathlen); pathdup [pathlen] = '\0'; currentloc->node_access = pathdup; currentloc->handlers = &rtems_ftpfs_handlers; } else { rtems_filesystem_eval_path_error(self, ENOMEM); } } }
static void rtems_tfs_eval_path(rtems_filesystem_eval_path_context_t *self) { int eval_flags = rtems_filesystem_eval_path_get_flags(self); if ((eval_flags & RTEMS_FS_MAKE) == 0) { int rw = RTEMS_FS_PERMS_READ | RTEMS_FS_PERMS_WRITE; if ((eval_flags & rw) != rw) { rtems_filesystem_location_info_t *currentloc = rtems_filesystem_eval_path_get_currentloc(self); char *current = currentloc->node_access; size_t currentlen = strlen(current); const char *path = rtems_filesystem_eval_path_get_path(self); size_t pathlen = rtems_filesystem_eval_path_get_pathlen(self); size_t len = currentlen + pathlen; rtems_filesystem_eval_path_clear_path(self); current = realloc(current, len + 1); if (current != NULL) { memcpy(current + currentlen, path, pathlen); current [len] = '\0'; if (!rtems_tfs_is_directory(current, len)) { fixPath (current); } currentloc->node_access = current; } else { rtems_filesystem_eval_path_error(self, ENOMEM); } } else { rtems_filesystem_eval_path_error(self, EINVAL); } } else { rtems_filesystem_eval_path_error(self, EIO); } }