aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Rostecki <michal.rostecki@gmail.com>2016-04-17 17:40:10 +0200
committerWill Deacon <will.deacon@arm.com>2016-04-18 12:01:52 +0100
commitd62653e177597251c24494a6dda60acd6d846671 (patch)
tree5548e0baad54f2dfcb3267f8cd2c9a73188d9461
parente8cb90fb9697da24cdf553a1b8cf120f94c20832 (diff)
downloadkvmtool-d62653e177597251c24494a6dda60acd6d846671.tar.gz
kvmtool: Change readdir_r to readdir
readdir_r is deprecated[1] and usage of readdir is recommended. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=7584a3f96de88d5eefe5d6c634515278cbfbf052 Signed-off-by: Michal Rostecki <michal.rostecki@gmail.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r--kvm-ipc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/kvm-ipc.c b/kvm-ipc.c
index 1ef3c3e4..e07ad105 100644
--- a/kvm-ipc.c
+++ b/kvm-ipc.c
@@ -137,7 +137,7 @@ int kvm__enumerate_instances(int (*callback)(const char *name, int fd))
{
int sock;
DIR *dir;
- struct dirent entry, *result;
+ struct dirent *entry;
int ret = 0;
const char *path;
@@ -148,25 +148,25 @@ int kvm__enumerate_instances(int (*callback)(const char *name, int fd))
return -errno;
for (;;) {
- readdir_r(dir, &entry, &result);
- if (result == NULL)
+ entry = readdir(dir);
+ if (!entry)
break;
- if (is_socket(path, &entry)) {
- ssize_t name_len = strlen(entry.d_name);
+ if (is_socket(path, entry)) {
+ ssize_t name_len = strlen(entry->d_name);
char *p;
if (name_len <= KVM_SOCK_SUFFIX_LEN)
continue;
- p = &entry.d_name[name_len - KVM_SOCK_SUFFIX_LEN];
+ p = &entry->d_name[name_len - KVM_SOCK_SUFFIX_LEN];
if (memcmp(KVM_SOCK_SUFFIX, p, KVM_SOCK_SUFFIX_LEN))
continue;
*p = 0;
- sock = kvm__get_sock_by_instance(entry.d_name);
+ sock = kvm__get_sock_by_instance(entry->d_name);
if (sock < 0)
continue;
- ret = callback(entry.d_name, sock);
+ ret = callback(entry->d_name, sock);
close(sock);
if (ret < 0)
break;