aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2019-09-10 12:45:43 +0200
committerNikolaus Rath <Nikolaus@rath.org>2019-09-10 14:25:15 +0100
commita0d713619d4f21e8240ede38eefe6101ea580724 (patch)
tree6977aebd8eeb375e10415a7e1e614061bcbf1b95
parent0889da0a870697c7f8c1ac683da27463d046d653 (diff)
downloadlibfuse-a0d713619d4f21e8240ede38eefe6101ea580724.tar.gz
passthrough_ll: use fuse_log() instead of err()/errx()
Send everything through fuse_log() instead of writing directly to stderr. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--example/passthrough_ll.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c
index 948ae5c..4e37602 100644
--- a/example/passthrough_ll.c
+++ b/example/passthrough_ll.c
@@ -50,7 +50,6 @@
#include <dirent.h>
#include <assert.h>
#include <errno.h>
-#include <err.h>
#include <inttypes.h>
#include <pthread.h>
#include <sys/file.h>
@@ -1248,10 +1247,15 @@ int main(int argc, char *argv[])
int res;
res = lstat(lo.source, &stat);
- if (res == -1)
- err(1, "failed to stat source (\"%s\")", lo.source);
- if (!S_ISDIR(stat.st_mode))
- errx(1, "source is not a directory");
+ if (res == -1) {
+ fuse_log(FUSE_LOG_ERR, "failed to stat source (\"%s\"): %m\n",
+ lo.source);
+ exit(1);
+ }
+ if (!S_ISDIR(stat.st_mode)) {
+ fuse_log(FUSE_LOG_ERR, "source is not a directory\n");
+ exit(1);
+ }
} else {
lo.source = "/";
@@ -1272,12 +1276,17 @@ int main(int argc, char *argv[])
break;
}
} else if (lo.timeout < 0) {
- errx(1, "timeout is negative (%lf)", lo.timeout);
+ fuse_log(FUSE_LOG_ERR, "timeout is negative (%lf)\n",
+ lo.timeout);
+ exit(1);
}
lo.root.fd = open(lo.source, O_PATH);
- if (lo.root.fd == -1)
- err(1, "open(\"%s\", O_PATH)", lo.source);
+ if (lo.root.fd == -1) {
+ fuse_log(FUSE_LOG_ERR, "open(\"%s\", O_PATH): %m\n",
+ lo.source);
+ exit(1);
+ }
se = fuse_session_new(&args, &lo_oper, sizeof(lo_oper), &lo);
if (se == NULL)