From 320237542051030e1a7349c6ec265f51dbc10d8b Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Tue, 8 Dec 2015 16:49:10 -0500 Subject: [PATCH] stap-server coverity fix: check stat(2) rc It's proper, so let's. --- stap-serverd.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stap-serverd.cxx b/stap-serverd.cxx index fa5ce455f..dc30d51c7 100644 --- a/stap-serverd.cxx +++ b/stap-serverd.cxx @@ -380,8 +380,8 @@ mok_dir_valid_p (string mok_fingerprint, bool verbose) // 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)) + int rc = stat((mok_dir + "/" + direntp->d_name).c_str (), &tmpstat); + if (rc == 0 && S_ISREG(tmpstat.st_mode)) reg_file = true; } @@ -479,8 +479,8 @@ get_server_mok_fingerprints(vector &mok_fingerprints, bool verbose, // 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)) + int rc = stat((mok_path + "/" + direntp->d_name).c_str (), &tmpstat); + if (rc || !S_ISDIR(tmpstat.st_mode)) continue; } else -- 2.43.5