Note that items with (!) have high priority.
+canonicalize
+------------
+ - reimplement realpath(3) (for lib/canonicalize()) to use fstatat(AT_NO_AUTOMOUNT)
+
lsblk
-----
- currently it does not show mountpoint for all devices in btrfs RAID. It's because
char *cn_tgt = NULL;
int rc;
- if (stat(tgt, &st) == 0 && S_ISDIR(st.st_mode)) {
+ if (mnt_stat_mountpoint(tgt, &st) == 0 && S_ISDIR(st.st_mode)) {
cache = mnt_context_get_cache(cxt);
cn_tgt = mnt_resolve_path(tgt, cache);
if (cn_tgt)
if (mnt_optstr_get_option(fs->user_optstr, "x-mount.mkdir", &mstr, &mstr_sz) != 0)
return 0;
- if (stat(tgt, &st) == 0)
+ if (mnt_stat_mountpoint(tgt, &st) == 0)
return 0;
if (mstr && mstr_sz) {
*/
struct stat st;
- if (stat(tgt, &st) == 0 && S_ISREG(st.st_mode)) {
+ if (mnt_stat_mountpoint(tgt, &st) == 0 && S_ISREG(st.st_mode)) {
int count;
struct libmnt_cache *cache = mnt_context_get_cache(cxt);
const char *bf = cache ? mnt_resolve_path(tgt, cache) : tgt;
&& !mnt_context_is_force(cxt)
&& !mnt_context_is_lazy(cxt)
&& !mnt_context_is_loopdel(cxt)
- && stat(tgt, &st) == 0 && S_ISDIR(st.st_mode)
+ && mnt_stat_mountpoint(tgt, &st) == 0 && S_ISDIR(st.st_mode)
&& !has_utab_entry(cxt, tgt)) {
const char *type = mnt_fs_get_fstype(cxt->fs);
extern void mnt_free_filesystems(char **filesystems);
extern char *mnt_get_kernel_cmdline_option(const char *name);
+extern int mnt_stat_mountpoint(const char *target, struct stat *st);
/* tab.c */
extern int is_mountinfo(struct libmnt_table *tb);
return strcmp(s1, s2);
}
+int mnt_stat_mountpoint(const char *target, struct stat *st)
+{
+#ifdef AT_NO_AUTOMOUNT
+ return fstatat(-1, target, st, AT_NO_AUTOMOUNT);
+#else
+ return stat(target, st);
+#endif
+}
+
/*
* Note that the @target has to be an absolute path (so at least "/"). The
* @filename returns an allocated buffer with the last path component, for example:
if (*mnt == '/' && *(mnt + 1) == '\0')
goto done;
- if (stat(mnt, &st))
+ if (mnt_stat_mountpoint(mnt, &st))
goto err;
base = st.st_dev;
if (!p)
break;
- if (stat(*mnt ? mnt : "/", &st))
+ if (mnt_stat_mountpoint(*mnt ? mnt : "/", &st))
goto err;
dir = st.st_dev;
if (dir != base) {