bcm57xx: Fix trivial warnings when building on Win32

This commit is contained in:
Richard Hughes 2020-10-22 13:55:14 +01:00
parent 1fd1a8047e
commit 3b577c5de3
2 changed files with 18 additions and 3 deletions

View File

@ -7,6 +7,10 @@
#include "config.h"
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <glib/gstdio.h>
#ifdef HAVE_ETHTOOL_H
#include <linux/ethtool.h>
#include <linux/sockios.h>
@ -564,6 +568,18 @@ fu_bcm57xx_device_open (FuDevice *device, GError **error)
#ifdef HAVE_SOCKET_H
FuBcm57xxDevice *self = FU_BCM57XX_DEVICE (device);
self->ethtool_fd = socket (AF_INET, SOCK_DGRAM, 0);
if (self->ethtool_fd < 0) {
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_NOT_SUPPORTED,
"failed to open socket: %s",
#ifdef HAVE_ERRNO_H
strerror (errno));
#else
"unspecified error");
#endif
return FALSE;
}
return TRUE;
#else
g_set_error_literal (error,
@ -578,8 +594,7 @@ static gboolean
fu_bcm57xx_device_close (FuDevice *device, GError **error)
{
FuBcm57xxDevice *self = FU_BCM57XX_DEVICE (device);
close (self->ethtool_fd);
return TRUE;
return g_close (self->ethtool_fd, error);
}
static void

View File

@ -611,8 +611,8 @@ fu_bcm57xx_recovery_device_setup (FuDevice *device, GError **error)
static gboolean
fu_bcm57xx_recovery_device_open (FuDevice *device, GError **error)
{
FuBcm57xxRecoveryDevice *self = FU_BCM57XX_RECOVERY_DEVICE (device);
#ifdef HAVE_MMAN_H
FuBcm57xxRecoveryDevice *self = FU_BCM57XX_RECOVERY_DEVICE (device);
FuUdevDevice *udev_device = FU_UDEV_DEVICE (device);
const gchar *sysfs_path = fu_udev_device_get_sysfs_path (udev_device);
#endif