mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-05 15:55:45 +00:00
Always use the more portable 3-arg form for open()
This commit is contained in:
parent
019a1bc2b0
commit
11d10a00e7
@ -187,7 +187,7 @@ fu_plugin_thunderbolt_power_kernel_force_power (FuPlugin *plugin, gboolean enabl
|
||||
return FALSE;
|
||||
}
|
||||
g_debug ("Setting force power to %d using kernel", enable);
|
||||
fd = g_open (data->force_path, O_WRONLY);
|
||||
fd = g_open (data->force_path, O_WRONLY, 0);
|
||||
if (fd == -1) {
|
||||
g_set_error (error,
|
||||
FWUPD_ERROR,
|
||||
|
@ -714,15 +714,28 @@ fu_udev_device_open (FuDevice *device, GError **error)
|
||||
|
||||
/* open device */
|
||||
if (priv->device_file != NULL) {
|
||||
priv->fd = g_open (priv->device_file, priv->readonly ? O_RDONLY : O_RDWR);
|
||||
if (priv->fd < 0) {
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"failed to open %s: %s",
|
||||
priv->device_file,
|
||||
strerror (errno));
|
||||
return FALSE;
|
||||
if (priv->readonly) {
|
||||
priv->fd = g_open (priv->device_file, O_RDONLY, 0);
|
||||
if (priv->fd < 0) {
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"failed to open %s for reading: %s",
|
||||
priv->device_file,
|
||||
strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
priv->fd = g_open (priv->device_file, O_RDWR, 0);
|
||||
if (priv->fd < 0) {
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
"failed to open %s: %s",
|
||||
priv->device_file,
|
||||
strerror (errno));
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user