diff options
author | Scott Mayhew <smayhew@redhat.com> | 2020-07-15 13:54:52 -0400 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2020-07-17 09:51:23 -0400 |
commit | 735bc7205530cb2e3ce99d73e6d8a33819ff3e88 (patch) | |
tree | 6cca46b950933f74ce180b41ffe006fc698d82ca | |
parent | 0794a85fa03aec7d06594e1f9f5143282b0a6728 (diff) | |
download | nfs-utils-735bc7205530cb2e3ce99d73e6d8a33819ff3e88.tar.gz |
nfsdcld: Fix a few Coverity Scan CHECKED_RETURN errors.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r-- | utils/nfsdcld/legacy.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/utils/nfsdcld/legacy.c b/utils/nfsdcld/legacy.c index 9e9f758d..b89374c9 100644 --- a/utils/nfsdcld/legacy.c +++ b/utils/nfsdcld/legacy.c @@ -51,18 +51,19 @@ legacy_load_clients_from_recdir(int *num_records) char recdirname[PATH_MAX+1]; char buf[NFS4_OPAQUE_LIMIT]; char *nl; + ssize_t n; fd = open(NFSD_RECDIR_FILE, O_RDONLY); if (fd < 0) { xlog(D_GENERAL, "Unable to open %s: %m", NFSD_RECDIR_FILE); return; } - if (read(fd, recdirname, PATH_MAX) < 0) { + n = read(fd, recdirname, PATH_MAX); + close(fd); + if (n < 0) { xlog(D_GENERAL, "Unable to read from %s: %m", NFSD_RECDIR_FILE); - close(fd); return; } - close(fd); /* the output from the proc file isn't null-terminated */ recdirname[PATH_MAX] = '\0'; nl = strchr(recdirname, '\n'); @@ -118,18 +119,19 @@ legacy_clear_recdir(void) char recdirname[PATH_MAX+1]; char dirname[PATH_MAX]; char *nl; + ssize_t n; fd = open(NFSD_RECDIR_FILE, O_RDONLY); if (fd < 0) { xlog(D_GENERAL, "Unable to open %s: %m", NFSD_RECDIR_FILE); return; } - if (read(fd, recdirname, PATH_MAX) < 0) { + n = read(fd, recdirname, PATH_MAX); + close(fd); + if (n < 0) { xlog(D_GENERAL, "Unable to read from %s: %m", NFSD_RECDIR_FILE); - close(fd); return; } - close(fd); /* the output from the proc file isn't null-terminated */ recdirname[PATH_MAX] = '\0'; nl = strchr(recdirname, '\n'); |