OBS-URL: https://build.opensuse.org/request/show/423993 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/lxcfs?expand=0&rev=6
67 lines
2.2 KiB
Diff
67 lines
2.2 KiB
Diff
From d639f86341f7f07f0ade0c937fd576586bfb949e Mon Sep 17 00:00:00 2001
|
|
From: Christian Brauner <cbrauner@suse.de>
|
|
Date: Sun, 21 Aug 2016 13:53:27 +0200
|
|
Subject: [PATCH 11/24] lxcfs, bindings: show "." and ".." dir entries
|
|
|
|
Signed-off-by: Christian Brauner <cbrauner@suse.de>
|
|
---
|
|
bindings.c | 17 +++++++++++------
|
|
lxcfs.c | 6 ++++--
|
|
2 files changed, 15 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/bindings.c b/bindings.c
|
|
index 04b2a5f..997db7b 100644
|
|
--- a/bindings.c
|
|
+++ b/bindings.c
|
|
@@ -1742,6 +1742,9 @@ int cg_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset
|
|
struct fuse_context *fc = fuse_get_context();
|
|
char **clist = NULL;
|
|
|
|
+ if (filler(buf, ".", NULL, 0) != 0 || filler(buf, "..", NULL, 0) != 0)
|
|
+ return -EIO;
|
|
+
|
|
if (d->type != LXC_TYPE_CGDIR) {
|
|
fprintf(stderr, "Internal error: file cache info used in readdir\n");
|
|
return -EIO;
|
|
@@ -4024,12 +4027,14 @@ int proc_getattr(const char *path, struct stat *sb)
|
|
int proc_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset,
|
|
struct fuse_file_info *fi)
|
|
{
|
|
- if (filler(buf, "cpuinfo", NULL, 0) != 0 ||
|
|
- filler(buf, "meminfo", NULL, 0) != 0 ||
|
|
- filler(buf, "stat", NULL, 0) != 0 ||
|
|
- filler(buf, "uptime", NULL, 0) != 0 ||
|
|
- filler(buf, "diskstats", NULL, 0) != 0 ||
|
|
- filler(buf, "swaps", NULL, 0) != 0)
|
|
+ if (filler(buf, ".", NULL, 0) != 0 ||
|
|
+ filler(buf, "..", NULL, 0) != 0 ||
|
|
+ filler(buf, "cpuinfo", NULL, 0) != 0 ||
|
|
+ filler(buf, "meminfo", NULL, 0) != 0 ||
|
|
+ filler(buf, "stat", NULL, 0) != 0 ||
|
|
+ filler(buf, "uptime", NULL, 0) != 0 ||
|
|
+ filler(buf, "diskstats", NULL, 0) != 0 ||
|
|
+ filler(buf, "swaps", NULL, 0) != 0)
|
|
return -EINVAL;
|
|
return 0;
|
|
}
|
|
diff --git a/lxcfs.c b/lxcfs.c
|
|
index 98b5d91..0c695b7 100644
|
|
--- a/lxcfs.c
|
|
+++ b/lxcfs.c
|
|
@@ -474,8 +474,10 @@ static int lxcfs_readdir(const char *path, void *buf, fuse_fill_dir_t filler, of
|
|
{
|
|
int ret;
|
|
if (strcmp(path, "/") == 0) {
|
|
- if (filler(buf, "proc", NULL, 0) != 0 ||
|
|
- filler(buf, "cgroup", NULL, 0) != 0)
|
|
+ if (filler(buf, ".", NULL, 0) != 0 ||
|
|
+ filler(buf, "..", NULL, 0) != 0 ||
|
|
+ filler(buf, "proc", NULL, 0) != 0 ||
|
|
+ filler(buf, "cgroup", NULL, 0) != 0)
|
|
return -EINVAL;
|
|
return 0;
|
|
}
|
|
--
|
|
2.9.3
|
|
|