jerryscript-project / jerryscript

Ultra-lightweight JavaScript engine for the Internet of Things.
https://jerryscript.net
Apache License 2.0
6.91k stars 669 forks source link

on unix, realpath are can failed when the path not exist #4983

Open lygstate opened 2 years ago

lygstate commented 2 years ago
jerry_char_t *
jerry_port_path_normalize (const jerry_char_t *path_p, /**< input path */
                           jerry_size_t path_size) /**< size of the path */
{
  (void) path_size;

  return (jerry_char_t *) realpath ((char *) path_p, NULL);
} /* jerry_port_path_normalize */

Currently the implementation of jerry_port_path_normalize are called realpath directly, than may return NULL when path_p is not NULL, but that's not expected.