The function is like real_path(), except that it returns NULL on error instead of dying. Signed-off-by: Michael Haggerty <mhagger@xxxxxxxxxxxx> --- abspath.c | 5 +++++ cache.h | 1 + 2 files changed, 6 insertions(+) diff --git a/abspath.c b/abspath.c index a7ab8e9..5748b91 100644 --- a/abspath.c +++ b/abspath.c @@ -146,6 +146,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]; diff --git a/cache.h b/cache.h index a58df84..b0d75bc 100644 --- a/cache.h +++ b/cache.h @@ -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); -- 1.7.11.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html