提交 e3e46cdb 编写于 作者: M Michael Haggerty 提交者: Jeff King

Introduce new function real_path_if_valid()

The function is like real_path(), except that it returns NULL on error
instead of dying.
Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: NJeff King <peff@peff.net>
上级 d6052abc
......@@ -153,6 +153,11 @@ const char *real_path(const char *path)
return real_path_internal(path, 1);
}
const char *real_path_if_valid(const char *path)
{
return real_path_internal(path, 0);
}
static const char *get_pwd_cwd(void)
{
static char cwd[PATH_MAX + 1];
......
......@@ -714,6 +714,7 @@ static inline int is_absolute_path(const char *path)
}
int is_directory(const char *);
const char *real_path(const char *path);
const char *real_path_if_valid(const char *path);
const char *absolute_path(const char *path);
const char *relative_path(const char *abs, const char *base);
int normalize_path_copy(char *dst, const char *src);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册