[PATCH] fix another d_type problem on xfs

qiaonuohan qiaonuohan@cn.fujitsu.com
Tue Apr 7 07:30:00 GMT 2015


Hello David,

This is an another d_type problem, please check.

On 04/07/2015 03:29 PM, qiaonuohan wrote:
> 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.
>


-- 
Regards
Qiao Nuohan



More information about the Systemtap mailing list