diff options
author | Scott Mayhew <smayhew@redhat.com> | 2020-07-15 13:48:40 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2020-07-17 09:51:23 -0400 |
commit | 2694463567e85627bf7e37f46bd3458b27130080 (patch) | |
tree | fd86763322691dcac596a9e1302d84e3770de9e5 | |
parent | 08c68a7e8df38ebca2590d4c8771672bdb78e26b (diff) | |
download | nfs-utils-2694463567e85627bf7e37f46bd3458b27130080.tar.gz |
nfsdcld: Fix a few Coverity Scan TOCTOU errors
Calling stat() on recdirname so that we can see if it's a directory is
unnecessary anyways, since opendir() will report an error if it's not.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r-- | utils/nfsdcld/legacy.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/utils/nfsdcld/legacy.c b/utils/nfsdcld/legacy.c index b8ea4ffe..1fb74d43 100644 --- a/utils/nfsdcld/legacy.c +++ b/utils/nfsdcld/legacy.c @@ -50,7 +50,6 @@ legacy_load_clients_from_recdir(int *num_records) struct dirent *entry; char recdirname[PATH_MAX]; char buf[NFS4_OPAQUE_LIMIT]; - struct stat st; char *nl; fd = open(NFSD_RECDIR_FILE, O_RDONLY); @@ -69,15 +68,6 @@ legacy_load_clients_from_recdir(int *num_records) if (!nl) return; *nl = '\0'; - if (stat(recdirname, &st) < 0) { - xlog(D_GENERAL, "Unable to stat %s: %d", recdirname, errno); - return; - } - if (!S_ISDIR(st.st_mode)) { - xlog(D_GENERAL, "%s is not a directory: mode=0%o", recdirname - , st.st_mode); - return; - } v4recovery = opendir(recdirname); if (!v4recovery) return; @@ -126,7 +116,6 @@ legacy_clear_recdir(void) struct dirent *entry; char recdirname[PATH_MAX]; char dirname[PATH_MAX]; - struct stat st; char *nl; fd = open(NFSD_RECDIR_FILE, O_RDONLY); @@ -145,15 +134,6 @@ legacy_clear_recdir(void) if (!nl) return; *nl = '\0'; - if (stat(recdirname, &st) < 0) { - xlog(D_GENERAL, "Unable to stat %s: %d", recdirname, errno); - return; - } - if (!S_ISDIR(st.st_mode)) { - xlog(D_GENERAL, "%s is not a directory: mode=0%o", recdirname - , st.st_mode); - return; - } v4recovery = opendir(recdirname); if (!v4recovery) return; |