From 0de533aef9def920fed751c6025e4f19c4cba763 Mon Sep 17 00:00:00 2001 From: Ingo Franzki Date: Tue, 7 Jan 2020 13:01:29 +0100 Subject: [PATCH] zkey: Fix listing of keys on file systems reporting DT_UNKNOWN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The zkey list function uses scandir() to look for files in the zkey key repository directory. It checks the dirent.d_type field to consider only regular files, but skip all others. Unfortunately, not all file systems have full support for returning the file type in d_type. When the zkey repository is located in a file system that does not support d_type, such as xfs, zkey list shows no keys, although the key repository contains keys. Fix this by also considering directory entries with d_type = DT_UNKNOWN. Signed-off-by: Ingo Franzki Signed-off-by: Jan Höppner --- zkey/keystore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zkey/keystore.c b/zkey/keystore.c index b5e17347..8ded144e 100644 --- a/zkey/keystore.c +++ b/zkey/keystore.c @@ -906,7 +906,7 @@ static int _keystore_info_file_filter(const struct dirent *dirent) { size_t len; - if (dirent->d_type != DT_REG) + if (dirent->d_type != DT_REG && dirent->d_type != DT_UNKNOWN) return 0; len = strlen(dirent->d_name);