viced.c: Don't store results of reads unecessarily
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Tue, 15 Jun 2010 17:15:34 +0000 (18:15 +0100)
committerJeffrey Altman <jaltman@openafs.org>
Sat, 23 Jul 2011 04:11:24 +0000 (21:11 -0700)
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 <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/viced/viced.c

index bfcb629..cb1d426 100644 (file)
@@ -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));