From 8f1f369b478fda735b7ec3235a4b9dec42729160 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 6 Jun 2016 19:55:59 +0200 Subject: 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) --- src/filelist.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/filelist.h') diff --git a/src/filelist.h b/src/filelist.h index 79d1e62..91e5fd0 100644 --- a/src/filelist.h +++ b/src/filelist.h @@ -55,6 +55,16 @@ struct __feh_file_info { #define FEH_FILE(l) ((feh_file *) l) #define FEH_MAX_DIRNAME_LEN 4096 +/* + * PATH_MAX may not be defined on all systems. Since we only use it in for a + * getcwd call in feh_absolute_path, it isn't really worth the effort to malloc + * ever-increasing buffers until it fits. Instead, we just set it to 4096 and + * have --filelist and --bg-* hiccup if the path is larger. + */ +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + enum filelist_recurse { FILELIST_FIRST, FILELIST_CONTINUE, FILELIST_LAST }; enum sort_type { -- cgit v1.2.3