aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/9p-local.c
diff options
context:
space:
mode:
authorGreg Kurz <gkurz@linux.vnet.ibm.com>2016-06-06 11:52:34 +0200
committerGreg Kurz <gkurz@linux.vnet.ibm.com>2016-06-06 11:52:34 +0200
commit635324e83e238598e86628dba5ab62ce910e6f72 (patch)
tree959af05a3fb65f914171fa2c343f8b3fef9130b6 /hw/9pfs/9p-local.c
parent7cde47d4a89d5efefcc805788bc29133f4f3c5c7 (diff)
downloadqemu-635324e83e238598e86628dba5ab62ce910e6f72.zip
qemu-635324e83e238598e86628dba5ab62ce910e6f72.tar.gz
qemu-635324e83e238598e86628dba5ab62ce910e6f72.tar.bz2
9p: switch back to readdir()
This patch changes the 9p code to use readdir() again instead of readdir_r(), which is deprecated in glibc 2.24. All the locking was put in place by a previous patch. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Diffstat (limited to 'hw/9pfs/9p-local.c')
-rw-r--r--hw/9pfs/9p-local.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index 3281acd..3f271fc 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -388,25 +388,27 @@ static off_t local_telldir(FsContext *ctx, V9fsFidOpenState *fs)
return telldir(fs->dir.stream);
}
-static int local_readdir_r(FsContext *ctx, V9fsFidOpenState *fs,
- struct dirent *entry,
- struct dirent **result)
+static struct dirent *local_readdir(FsContext *ctx, V9fsFidOpenState *fs)
{
- int ret;
+ struct dirent *entry;
again:
- ret = readdir_r(fs->dir.stream, entry, result);
+ entry = readdir(fs->dir.stream);
+ if (!entry) {
+ return NULL;
+ }
+
if (ctx->export_flags & V9FS_SM_MAPPED) {
entry->d_type = DT_UNKNOWN;
} else if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
- if (!ret && *result != NULL &&
- !strcmp(entry->d_name, VIRTFS_META_DIR)) {
+ if (!strcmp(entry->d_name, VIRTFS_META_DIR)) {
/* skp the meta data directory */
goto again;
}
entry->d_type = DT_UNKNOWN;
}
- return ret;
+
+ return entry;
}
static void local_seekdir(FsContext *ctx, V9fsFidOpenState *fs, off_t off)
@@ -1254,7 +1256,7 @@ FileOperations local_ops = {
.opendir = local_opendir,
.rewinddir = local_rewinddir,
.telldir = local_telldir,
- .readdir_r = local_readdir_r,
+ .readdir = local_readdir,
.seekdir = local_seekdir,
.preadv = local_preadv,
.pwritev = local_pwritev,