This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH] fix another d_type problem on xfs
- From: qiaonuohan <qiaonuohan at cn dot fujitsu dot com>
- To: <systemtap at sourceware dot org>
- Cc: <dsmith at redhat dot com>
- Date: Tue, 7 Apr 2015 15:29:39 +0800
- Subject: [PATCH] fix another d_type problem on xfs
- Authentication-results: sourceware.org; auth=none
Function get_server_mok_fingerprints is supposed to find mok on server.
Because of d_type problem on xfs, existing mok will be ignored.
Signed-off-by: qiaonuohan <qiaonuohan@cn.fujitsu.com>
---
stap-serverd.cxx | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/stap-serverd.cxx b/stap-serverd.cxx
index 917c52a..cedc017 100644
--- a/stap-serverd.cxx
+++ b/stap-serverd.cxx
@@ -473,7 +473,19 @@ get_server_mok_fingerprints(vector<string> &mok_fingerprints, bool verbose,
{
// We're only interested in directories (of key files).
if (direntp->d_type != DT_DIR)
- continue;
+ {
+ if (direntp->d_type == DT_UNKNOWN)
+ {
+ // If the filesystem doesn't support d_type, we'll have to
+ // call stat().
+ struct stat tmpstat;
+ stat((mok_path + "/" + direntp->d_name).c_str (), &tmpstat);
+ if (!S_ISDIR(tmpstat.st_mode))
+ continue;
+ }
+ else
+ continue;
+ }
// We've got a directory. If the directory name isn't in the right
// format for a MOK fingerprint, skip it.
--
1.8.3.1