aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhuman <human@neet.fi>2021-01-05 03:17:07 +0200
committerhuman <human@neet.fi>2021-01-05 03:18:25 +0200
commit509a0e1ce9e5106790c9588f1b95db1deea7761d (patch)
treee6920d6a06fb109488ce4774812673be8ebe0c12
parent57331e2092ec8d7cd5ebb4b8b6ec2bdf2d2b5661 (diff)
support TABFS_MOUNT_DIR
-rw-r--r--fs/tabfs.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/tabfs.c b/fs/tabfs.c
index 5c27faf..103bec8 100644
--- a/fs/tabfs.c
+++ b/fs/tabfs.c
@@ -440,6 +440,10 @@ static const struct fuse_operations tabfs_oper = {
int main(int argc, char **argv) {
(void)argc;
+ if (NULL == getenv("TABFS_MOUNT_DIR")) {
+ setenv("TABFS_MOUNT_DIR", "mnt", 1);
+ }
+
freopen("log.txt", "a", stderr);
setvbuf(stderr, NULL, _IONBF, 0);
@@ -448,14 +452,14 @@ int main(int argc, char **argv) {
system(killcmd);
#if defined(__APPLE__)
- system("diskutil umount force mnt >/dev/null");
+ system("diskutil umount force \"$TABFS_MOUNT_DIR\" >/dev/null");
#elif defined(__FreeBSD__)
- system("umount -f mnt 2>/dev/null");
+ system("umount -f \"$TABFS_MOUNT_DIR\" 2>/dev/null");
#else
- system("fusermount -u mnt 2>/dev/null");
+ system("fusermount -u \"$TABFS_MOUNT_DIR\" 2>/dev/null");
#endif
- mkdir("mnt", 0755);
+ system("mkdir -p \"$TABFS_MOUNT_DIR\"");
pthread_t thread;
int err = pthread_create(&thread, NULL, reader_main, NULL);
@@ -472,7 +476,7 @@ int main(int argc, char **argv) {
"-oauto_unmount",
#endif
"-odirect_io",
- "mnt",
+ getenv("TABFS_MOUNT_DIR"),
NULL,
};
return fuse_main(