Skip to content

Commit 431bdb5

Browse files
committed
NFS: Delete dead code
Since commit f2eaaa3 in year 2000 the typedef struct my_fsid has a field 'char Opaque_Handle[2 * 32 + 1];' Thus sizeof(*fsidp) is > 14. Delete the else block as dead code and the two useless if. This should remove two Visual Studio warnings: parsenfsfh.c(318,25): warning C4127: conditional expression is constant parsenfsfh.c(319,22): warning C4127: conditional expression is constant
1 parent 805fd42 commit 431bdb5

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

parsenfsfh.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -315,20 +315,9 @@ Parse_fh(netdissect_options *ndo, const unsigned char *fh, u_int len,
315315

316316
case FHT_VMSUCX:
317317
/* No numeric file system ID, so hash on the device-name */
318-
if (sizeof(*fsidp) >= 14) {
319-
if (sizeof(*fsidp) > 14)
320-
memset((char *)fsidp, 0, sizeof(*fsidp));
321-
/* just use the whole thing */
322-
memcpy((char *)fsidp, (const char *)fh, 14);
323-
} else {
324-
uint32_t tempa[4]; /* at least 16 bytes, maybe more */
325-
326-
memset((char *)tempa, 0, sizeof(tempa));
327-
memcpy((char *)tempa, (const char *)fh, 14); /* ensure alignment */
328-
fsidp->Fsid_dev.Minor = tempa[0] + (tempa[1]<<1);
329-
fsidp->Fsid_dev.Major = tempa[2] + (tempa[3]<<1);
330-
fsidp->fsid_code = 0;
331-
}
318+
memset((char *)fsidp, 0, sizeof(*fsidp));
319+
/* just use the whole thing */
320+
memcpy((char *)fsidp, (const char *)fh, 14);
332321

333322
/* VMS file ID is: (RVN, FidHi, FidLo) */
334323
*inop = (((uint32_t) GET_U_1(fhp + 26)) << 24) |

0 commit comments

Comments
 (0)