From 635324e83e238598e86628dba5ab62ce910e6f72 Mon Sep 17 00:00:00 2001 From: Greg Kurz Date: Mon, 6 Jun 2016 11:52:34 +0200 Subject: 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 Signed-off-by: Greg Kurz --- hw/9pfs/9p-local.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'hw/9pfs/9p-local.c') 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, -- cgit v1.1