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@xxxxxxxxx> --- kvm-ipc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/kvm-ipc.c b/kvm-ipc.c index 1ef3c3e..e07ad10 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; -- 2.8.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html