[PATCH RFC] Fix failure of signing modules on XFS
qiaonuohan
qiaonuohan@cn.fujitsu.com
Tue Apr 7 02:16:00 GMT 2015
Hello David,
On 04/07/2015 01:06 AM, David Smith wrote:
> But, I'd like to avoid the stat() syscall when possible. So, I tweaked
> your patch a bit. The following compiles, but I haven't tried it.
>
> Let me know if it works for you and I'll check it in.
Handleing DT_UNKNOWN seems better. And the following patch work well on my
machine. Thanks.
>
> ====
> diff --git a/stap-serverd.cxx b/stap-serverd.cxx
> index 40b3c39..98611c9 100644
> --- a/stap-serverd.cxx
> +++ b/stap-serverd.cxx
> @@ -370,13 +370,28 @@ mok_dir_valid_p (string mok_fingerprint, bool verbose)
> struct dirent *direntp;
> while ((direntp = readdir (dirp)) != NULL)
> {
> - if (! priv_found && direntp->d_type == DT_REG
> + bool reg_file = false;
> +
> + if (direntp->d_type == DT_REG)
> + reg_file = true;
> + else if (direntp->d_type == DT_UNKNOWN)
> + {
> + struct stat tmpstat;
> +
> + // If the filesystem doesn't support d_type, we'll have to
> + // call stat().
> + stat((mok_dir + "/" + direntp->d_name).c_str (), &tmpstat);
> + if (S_ISREG(tmpstat.st_mode))
> + reg_file = true;
> + }
> +
> + if (! priv_found && reg_file
> && strcmp (direntp->d_name, MOK_PRIVATE_CERT_NAME) == 0)
> {
> priv_found = true;
> continue;
> }
> - if (! cert_found && direntp->d_type == DT_REG
> + if (! cert_found && reg_file
> && strcmp (direntp->d_name, MOK_PUBLIC_CERT_NAME) == 0)
> {
> cert_found = true;
> ====
--
Regards
Qiao Nuohan
More information about the Systemtap
mailing list