From 36ba460fe4edd25c6bfd5daae8b25a7d2dc23d68 Mon Sep 17 00:00:00 2001 From: François Revol Date: Wed, 2 Jul 2014 03:40:32 +0200 Subject: beos: handle realpath() returning NULL Else we return with an uninitialized buffer... --- beos/gui.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'beos/gui.cpp') diff --git a/beos/gui.cpp b/beos/gui.cpp index 19046a5e4..9ecfbd0ff 100644 --- a/beos/gui.cpp +++ b/beos/gui.cpp @@ -309,12 +309,18 @@ static char *find_resource(char *buf, const char *filename, const char *def) if (def[0] == '%') { snprintf(t, PATH_MAX, "%s%s", path.Path(), def + 1); - realpath(t, buf); + if (realpath(t, buf) == NULL) { + strcpy(buf, t); + } } else if (def[0] == '~') { snprintf(t, PATH_MAX, "%s%s", getenv("HOME"), def + 1); - realpath(t, buf); + if (realpath(t, buf) == NULL) { + strcpy(buf, t); + } } else { - realpath(def, buf); + if (realpath(def, buf) == NULL) { + strcpy(buf, def); + } } return buf; -- cgit v1.2.3