From ba18ea65174dd06a305e3524756aaca6ebb04e9a Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 15 Jun 2010 18:15:34 +0100 Subject: [PATCH] viced.c: Don't store results of reads unecessarily When we don't need to store the amount of data read from a file, don't complicate the if() statement by adding a pointless assignment. Caught by clang-analyzer Change-Id: I326d894c9b5f7a89f31534c7864e05ea059a03aa Reviewed-on: http://gerrit.openafs.org/5079 Reviewed-by: Derrick Brashear Tested-by: BuildBot Reviewed-by: Jeffrey Altman --- src/viced/viced.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/viced/viced.c b/src/viced/viced.c index bfcb629b1..cb1d42641 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -1654,7 +1654,7 @@ ReadSysIdFile(void) errno)); return EIO; } - if ((i = read(fd, (char *)&vsn, sizeof(vsn))) != sizeof(vsn)) { + if (read(fd, (char *)&vsn, sizeof(vsn)) != sizeof(vsn)) { ViceLog(0, ("%s: Read failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH, errno)); @@ -1672,9 +1672,8 @@ ReadSysIdFile(void) AFSDIR_SERVER_SYSID_FILEPATH, vsn.version, SYSIDVERSION)); return EIO; } - if ((i = - read(fd, (char *)&uuid, - sizeof(struct afsUUID))) != sizeof(struct afsUUID)) { + if (read(fd, (char *)&uuid, sizeof(struct afsUUID)) + != sizeof(struct afsUUID)) { ViceLog(0, ("%s: read of uuid failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH, errno)); @@ -1682,9 +1681,7 @@ ReadSysIdFile(void) } afs_ntohuuid(&uuid); FS_HostUUID = uuid; - if ((i = - read(fd, (char *)&nentries, - sizeof(afs_int32))) != sizeof(afs_int32)) { + if (read(fd, (char *)&nentries, sizeof(afs_int32)) != sizeof(afs_int32)) { ViceLog(0, ("%s: Read of entries failed (%d)\n", AFSDIR_SERVER_SYSID_FILEPATH, errno)); -- 2.39.5