mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-03-05 14:51:47 +03:00
beos: handle realpath() returning NULL
Else we return with an uninitialized buffer...
This commit is contained in:
parent
dcf3a55ae6
commit
36ba460fe4
12
beos/gui.cpp
12
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user