mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-08 10:27:47 +00:00
trivial: Use O_APPEND for FU_EFIVAR_ATTR_APPEND_WRITE
This commit is contained in:
parent
891de60df5
commit
b53661676c
@ -349,6 +349,7 @@ fu_efivar_set_data (const gchar *guid, const gchar *name, const guint8 *data,
|
|||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
int fd;
|
int fd;
|
||||||
|
int open_wflags;
|
||||||
gboolean was_immutable;
|
gboolean was_immutable;
|
||||||
g_autofree gchar *fn = fu_efivar_get_filename (guid, name);
|
g_autofree gchar *fn = fu_efivar_get_filename (guid, name);
|
||||||
g_autofree guint8 *buf = g_malloc0 (sizeof(guint32) + sz);
|
g_autofree guint8 *buf = g_malloc0 (sizeof(guint32) + sz);
|
||||||
@ -374,8 +375,11 @@ fu_efivar_set_data (const gchar *guid, const gchar *name, const guint8 *data,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open file for writing */
|
/* open file for writing, optionally append */
|
||||||
fd = open (fn, O_WRONLY);
|
open_wflags = O_WRONLY;
|
||||||
|
if (attr & FU_EFIVAR_ATTR_APPEND_WRITE)
|
||||||
|
open_wflags |= O_APPEND;
|
||||||
|
fd = open (fn, open_wflags);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_IO_ERROR,
|
G_IO_ERROR,
|
||||||
|
Loading…
Reference in New Issue
Block a user