summaryrefslogtreecommitdiff
path: root/src/lib/rib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/rib.c')
-rw-r--r--src/lib/rib.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/lib/rib.c b/src/lib/rib.c
index a019a087..97a20f47 100644
--- a/src/lib/rib.c
+++ b/src/lib/rib.c
@@ -1,5 +1,5 @@
/*
- * Ouroboros - Copyright (C) 2016 - 2022
+ * Ouroboros - Copyright (C) 2016 - 2024
*
* RIB export using FUSE
*
@@ -139,6 +139,10 @@ static int rib_readdir(const char * path,
(void) offset;
(void) info;
+ /* Fix ls calling readdir in an infinite loop on raspbian. */
+ if (info != NULL && info->nonseekable != 0)
+ return -ENOENT;
+
filler(buf, ".", NULL, 0);
filler(buf, "..", NULL, 0);
@@ -203,12 +207,15 @@ static size_t __getattr(const char * path,
if (strcmp(comp, r->path) == 0) {
size_t ret = r->ops->getattr(path + 1, &attr);
pthread_rwlock_unlock(&rib.lock);
- st->st_mode = S_IFREG | 0755;
- st->st_nlink = 1;
- st->st_uid = getuid();
- st->st_gid = getgid();
- st->st_size = attr.size;
- st->st_mtime = attr.mtime;
+ st->st_mode = S_IFREG | 0644;
+ st->st_blocks = 1;
+ st->st_nlink = 1;
+ st->st_uid = getuid();
+ st->st_gid = getgid();
+ st->st_size = attr.size;
+ st->st_atime = attr.mtime;
+ st->st_mtime = attr.mtime;
+ st->st_ctime = attr.mtime;
return ret;
}
}
@@ -252,6 +259,8 @@ static int rib_getattr(const char * path,
st->st_uid = getuid();
st->st_gid = getgid();
st->st_mtime = now.tv_sec;
+ st->st_atime = now.tv_sec;
+ st->st_ctime = now.tv_sec;
return 0;
}
@@ -382,6 +391,16 @@ void rib_fini(void)
#endif
}
+void rib_cleanup(const char * mnt)
+{
+#ifdef HAVE_FUSE
+ fuse_unmount(mnt, NULL);
+ rmdir(mnt);
+#else
+ (void) mnt;
+#endif
+}
+
int rib_reg(const char * path,
struct rib_ops * ops)
{