aports/community/guvcview/fpathconf.patch
Natanael Copa 90e371ec8b community/guvcview: fix build on ppc64le
Apparently they removed the checks for HAVE_FPATHCONF and HAVE_DIRFD and
the fallback broke ppc64le.

fpathconf is in POSIX.1-2008 so assume its there.
2025-01-03 15:36:26 +01:00

27 lines
929 B
Diff

Assume existence of fpathconf which is in POSIX.1-2008
diff --git a/guvcview/core_io.c b/guvcview/core_io.c
index 73a116d..62e941e 100644
--- a/guvcview/core_io.c
+++ b/guvcview/core_io.c
@@ -314,20 +314,12 @@ char *set_file_extension(const char *filename, const char *ext) {
size_t dirent_buf_size(DIR *dirp) {
long name_max;
size_t name_end;
-#if defined(HAVE_FPATHCONF) && defined(HAVE_DIRFD) && defined(_PC_NAME_MAX)
name_max = fpathconf(dirfd(dirp), _PC_NAME_MAX);
if (name_max == -1)
#if defined(NAME_MAX)
name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
#else
return (size_t)(-1);
-#endif
-#else
-#if defined(NAME_MAX)
- name_max = (NAME_MAX > 255) ? NAME_MAX : 255;
-#else
-#error "buffer size for readdir_r cannot be determined"
-#endif
#endif
name_end = (size_t)offsetof(struct dirent, d_name) + name_max + 1;
return (name_end > sizeof(struct dirent) ? name_end : sizeof(struct dirent));