summaryrefslogtreecommitdiff
path: root/beos/gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'beos/gui.cpp')
-rw-r--r--beos/gui.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 84f397b0b..cb7effead 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -299,22 +299,28 @@ static char *find_resource(char *buf, const char *filename, const char *def)
BPathFinder f((void*)find_resource);
BPath p;
- f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res/", p);
- strcpy(t, p.Path());
-
- strcat(t, filename);
- realpath(t, buf);
- if (access(buf, R_OK) == 0)
- return buf;
+ if (f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res", p) == B_OK) {
+ strcpy(t, p.Path());
+ strcat(t, filename);
+ realpath(t, buf);
+ if (access(buf, R_OK) == 0)
+ return buf;
+ }
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;
@@ -724,8 +730,8 @@ static void gui_poll(bool active)
// our own event pipe
FD_SET(sEventPipe[0], &read_fd_set);
- /** @todo Check if this max_fd should have + 1 */
- max_fd = MAX(max_fd, sEventPipe[0] + 1);
+ // max of all the fds in the set, plus one for select()
+ max_fd = MAX(max_fd, sEventPipe[0]) + 1;
// compute schedule timeout
if (earliest_callback_timeout != B_INFINITE_TIMEOUT) {