Correct incorrect type-punning fixes
[openafs.git] / src / rxdebug / rxdebug.c
index da5ffd6..86f105b 100644 (file)
@@ -278,21 +278,20 @@ MainCommand(struct cmd_syndesc *as, void *arock)
            fprintf(stderr,
                    "WARNING: Server doesn't support retrieval of Rx statistics\n");
        } else {
-           union {
-               struct rx_statistics rxstats;
-               struct rx_debugIn debug;
-           } packet;
+           struct rx_statistics rxstats;
 
            /* should gracefully handle the case where rx_stats grows */
            code =
-               rx_GetServerStats(s, host, port, &packet.rxstats,
+               rx_GetServerStats(s, host, port, &rxstats,
                                  &supportedStatValues);
            if (code < 0) {
                printf("rxstats call failed with code %d\n", code);
                exit(1);
            }
-           if (code != sizeof(packet.rxstats)) {
-               if (packet.debug.type == RX_DEBUGI_BADTYPE)
+           if (code != sizeof(rxstats)) {
+               struct rx_debugIn debug;
+               memcpy(&debug, &rxstats, sizeof(debug));
+               if (debug.type == RX_DEBUGI_BADTYPE)
                    goto noRxStats;
                printf
                    ("WARNING: returned Rx statistics of unexpected size (got %d)\n",
@@ -300,7 +299,7 @@ MainCommand(struct cmd_syndesc *as, void *arock)
                /* handle other versions?... */
            }
 
-           rx_PrintTheseStats(stdout, &packet.rxstats, sizeof(packet.rxstats),
+           rx_PrintTheseStats(stdout, &rxstats, sizeof(rxstats),
                               tstats.nFreePackets, tstats.version);
        }
     }