From e3e46cdbd45c2e7383df9de1787e23489dc66dbc Mon Sep 17 00:00:00 2001 From: Michael Haggerty Date: Sun, 28 Oct 2012 17:16:22 +0100 Subject: 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: Michael Haggerty Signed-off-by: Jeff King --- abspath.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'abspath.c') diff --git a/abspath.c b/abspath.c index f8a526f391..40cdc46219 100644 --- a/abspath.c +++ b/abspath.c @@ -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]; -- cgit v1.2.3