Skip to content

Commit

Permalink
preload: wrap fstatfs() and statfs() on musl
Browse files Browse the repository at this point in the history
musl has both of these functions (though not the separate "64" variants
that glibc).

Thanks to Alyssa Ross @alyssais for finding this and the initial patch!
  • Loading branch information
martinpitt committed Jan 31, 2024
1 parent 539af0b commit 5a3c090
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libumockdev-preload.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,8 @@ int statx(int dirfd, const char *pathname, int flags, unsigned mask, struct stat
return r;
}

#endif /* __GLIBC__ */

static bool is_dir_or_contained(const char *path, const char *dir, const char *subdir)
{
if (!path || !dir)
Expand Down Expand Up @@ -1490,7 +1492,9 @@ int fstatfs ## suffix(int fd, struct statfs ## suffix *buf) \
}

WRAP_FSTATFS();
#ifdef __GLIBC__
WRAP_FSTATFS(64);
#endif

#define WRAP_STATFS(suffix) \
int statfs ## suffix(const char *path, struct statfs ## suffix *buf) { \
Expand All @@ -1512,8 +1516,8 @@ int statfs ## suffix(const char *path, struct statfs ## suffix *buf) { \
}

WRAP_STATFS();
#ifdef __GLIBC__
WRAP_STATFS(64);

#endif

int __open_2(const char *path, int flags);
Expand Down

0 comments on commit 5a3c090

Please sign in to comment.