summaryrefslogtreecommitdiff
path: root/src/filelist.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-06-06 19:55:59 +0200
committerDaniel Friesel <derf@finalrewind.org>2016-06-06 19:55:59 +0200
commit8f1f369b478fda735b7ec3235a4b9dec42729160 (patch)
tree4f1eb0d71de26ad46e69d9c90b6eff7b82019bea /src/filelist.c
parent09c59148f8cdc1cb1cb83cb63f6edacec617a446 (diff)
Define PATH_MAX ourselves if it isn't defined by the OS (closes #90)
This is kinda sloppy coding (feh --filelist and --bg-* will fail when running on a system with path lengths >= 4096 and PATH_MAX not defined), but that's sufficiently improbable to be okay. (plus, I ain't getting paid for this, so if you want to improve it feel free to do so)
Diffstat (limited to 'src/filelist.c')
-rw-r--r--src/filelist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/filelist.c b/src/filelist.c
index 8956238..ebae08d 100644
--- a/src/filelist.c
+++ b/src/filelist.c
@@ -623,7 +623,8 @@ char *feh_absolute_path(char *path)
/* I SHOULD be able to just use a simple realpath() here, but dumb *
old Solaris's realpath doesn't return an absolute path if the
path you give it is relative. Linux and BSD get this right... */
- getcwd(cwd, sizeof(cwd));
+ if (getcwd(cwd, sizeof(cwd)) == NULL)
+ eprintf("Cannot determine working directory:");
snprintf(temp, sizeof(temp), "%s/%s", cwd, path);
if (realpath(temp, fullpath) != NULL) {
ret = estrdup(fullpath);