mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-08 12:49:24 +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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_debug ("Setting force power to %d using kernel", enable);
|
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) {
|
if (fd == -1) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
FWUPD_ERROR,
|
FWUPD_ERROR,
|
||||||
|
@ -714,7 +714,19 @@ fu_udev_device_open (FuDevice *device, GError **error)
|
|||||||
|
|
||||||
/* open device */
|
/* open device */
|
||||||
if (priv->device_file != NULL) {
|
if (priv->device_file != NULL) {
|
||||||
priv->fd = g_open (priv->device_file, priv->readonly ? O_RDONLY : O_RDWR);
|
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) {
|
if (priv->fd < 0) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_IO_ERROR,
|
G_IO_ERROR,
|
||||||
@ -725,6 +737,7 @@ fu_udev_device_open (FuDevice *device, GError **error)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* subclassed */
|
/* subclassed */
|
||||||
if (klass->open != NULL) {
|
if (klass->open != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user