Browse Source

[core] dlsym for FAMNoExists() for compat w/ fam

gamin should be used instead of fam; fam is no longer maintained

This patch makes it safe to build lighttpd with gamin, but run on
systems with the (deprecated) fam installed, which can happen due
to historical package dependency declarations on some platforms
(Debian, Ubuntu).

gamin and fam are not 100% binary compatible.
(Among other things, fam does not provide FAMNoExists())

x-ref:
  "llibgamin vs libfam conflict solving"
  https://salsa.debian.org/debian/lighttpd/-/merge_requests/18
  "libgamin0: libfam shlib dependency wrongly set to libfam0"
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510368
  "undefined symbol: FAMNoExists"
  https://bugs.launchpad.net/bugs/1453463
master
Glenn Strauss 1 year ago
parent
commit
3e046ccabf
  1. 13
      src/stat_cache.c

13
src/stat_cache.c

@ -125,6 +125,12 @@ static void * stat_cache_sptree_find(splay_tree ** const sptree,
#include <fam.h>
#ifdef HAVE_FAMNOEXISTS
#ifndef LIGHTTPD_STATIC
#include <dlfcn.h>
#endif
#endif
typedef struct fam_dir_entry {
buffer *name;
int refcnt;
@ -364,7 +370,14 @@ static stat_cache_fam * stat_cache_init_fam(fdevents *ev, log_error_st *errh) {
return NULL;
}
#ifdef HAVE_FAMNOEXISTS
#ifdef LIGHTTPD_STATIC
FAMNoExists(&scf->fam);
#else
int (*FAMNoExists_fn)(FAMConnection *);
FAMNoExists_fn =
(int (*)(FAMConnection *))(intptr_t)dlsym(RTLD_DEFAULT,"FAMNoExists");
if (FAMNoExists_fn) FAMNoExists_fn(&scf->fam);
#endif
#endif
scf->fd = FAMCONNECTION_GETFD(&scf->fam);

Loading…
Cancel
Save