mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virNWFilterSnoopLeaseFileLoad: Don't typecast 'ipl.timeout'
Use a temporary variable to avoid memory alignment issues on ARM: ../src/nwfilter/nwfilter_dhcpsnoop.c: In function ‘virNWFilterSnoopLeaseFileLoad’: ../src/nwfilter/nwfilter_dhcpsnoop.c:1745:20: error: cast increases required alignment of target type [-Werror=cast-align] 1745 | (unsigned long long *) &ipl.timeout, | Fixes: 0d278aa089bf3a00bf2d6e56d2f01ea4677190a7 Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
8858a3cc35
commit
bb80344fd0
@ -1733,6 +1733,8 @@ virNWFilterSnoopLeaseFileLoad(void)
|
|||||||
fp = fopen(LEASEFILE, "r");
|
fp = fopen(LEASEFILE, "r");
|
||||||
time(&now);
|
time(&now);
|
||||||
while (fp && fgets(line, sizeof(line), fp)) {
|
while (fp && fgets(line, sizeof(line), fp)) {
|
||||||
|
unsigned long long timeout;
|
||||||
|
|
||||||
if (line[strlen(line)-1] != '\n') {
|
if (line[strlen(line)-1] != '\n') {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("virNWFilterSnoopLeaseFileLoad lease file "
|
_("virNWFilterSnoopLeaseFileLoad lease file "
|
||||||
@ -1742,13 +1744,13 @@ virNWFilterSnoopLeaseFileLoad(void)
|
|||||||
ln++;
|
ln++;
|
||||||
/* key len 54 = "VMUUID"+'-'+"MAC" */
|
/* key len 54 = "VMUUID"+'-'+"MAC" */
|
||||||
if (sscanf(line, "%llu %54s %15s %15s",
|
if (sscanf(line, "%llu %54s %15s %15s",
|
||||||
(unsigned long long *) &ipl.timeout,
|
&timeout, ifkey, ipstr, srvstr) < 4) {
|
||||||
ifkey, ipstr, srvstr) < 4) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("virNWFilterSnoopLeaseFileLoad lease file "
|
_("virNWFilterSnoopLeaseFileLoad lease file "
|
||||||
"line %d corrupt"), ln);
|
"line %d corrupt"), ln);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
ipl.timeout = timeout;
|
||||||
if (ipl.timeout && ipl.timeout < now)
|
if (ipl.timeout && ipl.timeout < now)
|
||||||
continue;
|
continue;
|
||||||
req = virNWFilterSnoopReqGetByIFKey(ifkey);
|
req = virNWFilterSnoopReqGetByIFKey(ifkey);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user