diff options
author | Matthias Görgens <matthias.goergens@gmail.com> | 2023-04-02 17:45:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-02 10:45:27 +0100 |
commit | 7be56c57f93e3436b1fbd9ecc320de5c03a3e4b8 (patch) | |
tree | 91ba1e928cca176f23776715dc076a99ea36bd82 /meson.build | |
parent | 2113871279d3c270c01c54c81782e982ec6e8246 (diff) | |
download | libfuse-7be56c57f93e3436b1fbd9ecc320de5c03a3e4b8.tar.gz |
Workaround musl bug when mountdir has whitespace (#761)
Fixes https://github.com/libfuse/libfuse/issues/634 and https://github.com/mpartel/bindfs/issues/106
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/meson.build b/meson.build index 0b3bd68..6aa23c1 100644 --- a/meson.build +++ b/meson.build @@ -151,6 +151,38 @@ else message('Disabling versioned libc symbols') endif +# Older versions of musl libc don't unescape entries in /etc/mtab +# Try to detect this behaviour, and work around, if necessary. +detect_getmntent_needs_unescape = ''' +#define _GNU_SOURCE +#include <mntent.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +#define dir_space_tab "dir\\040space\\011tab" + +int main() +{ + const char *fake_mtab = "name " dir_space_tab " type opts 0 0\n"; + FILE *f = fmemopen((void *)fake_mtab, strlen(fake_mtab) + 1, "r"); + struct mntent *entp = getmntent(f); + fclose(f); + if(NULL == entp) + exit(EXIT_FAILURE); + if (0 == strcmp(entp->mnt_dir, dir_space_tab)) + printf("needs escaping\n"); + else + printf("no need to escape\n"); +} +''' + +result = cc.run(detect_getmntent_needs_unescape) +if result.compiled() and result.returncode() == 0 and result.stdout().strip() == 'needs escaping' + message('getmntent does not unescape') + add_project_arguments('-DGETMNTENT_NEEDS_UNESCAPING', language: 'c') +endif + # Write private test results into fuse_config.h (stored in build directory) configure_file(output: 'fuse_config.h', configuration : private_cfg) |