diff options
author | François Revol <revol@free.fr> | 2014-07-02 03:40:32 +0200 |
---|---|---|
committer | François Revol <revol@free.fr> | 2014-07-02 03:40:32 +0200 |
commit | 36ba460fe4edd25c6bfd5daae8b25a7d2dc23d68 (patch) | |
tree | b1956b023edaf904752985ce330c3e8e20e4e135 | |
parent | dcf3a55ae6083da252af43d7958981080e7e9e41 (diff) | |
download | netsurf-36ba460fe4edd25c6bfd5daae8b25a7d2dc23d68.tar.gz netsurf-36ba460fe4edd25c6bfd5daae8b25a7d2dc23d68.tar.bz2 |
beos: handle realpath() returning NULL
Else we return with an uninitialized buffer...
-rw-r--r-- | beos/gui.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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; |