mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-05 06:33:50 +02:00
efivar: update to 38.
This commit is contained in:
parent
83ddaea84f
commit
dfc7f33631
8 changed files with 313 additions and 229 deletions
|
@ -1745,6 +1745,7 @@ libxmlsec1-gcrypt.so.1 xmlsec1-1.2.31_2
|
||||||
libxmlsec1-gnutls.so.1 xmlsec1-1.2.31_2
|
libxmlsec1-gnutls.so.1 xmlsec1-1.2.31_2
|
||||||
libefivar.so.1 libefivar-31_1
|
libefivar.so.1 libefivar-31_1
|
||||||
libefiboot.so.1 libefivar-31_1
|
libefiboot.so.1 libefivar-31_1
|
||||||
|
libefisec.so.1 libefivar-38_1
|
||||||
libportaudio.so.2 portaudio-19.20140130_1
|
libportaudio.so.2 portaudio-19.20140130_1
|
||||||
libportaudiocpp.so.0 portaudio-cpp-19.20140130_1
|
libportaudiocpp.so.0 portaudio-cpp-19.20140130_1
|
||||||
libdar.so.6000 libdar-2.6.6_1
|
libdar.so.6000 libdar-2.6.6_1
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
From 41d039a327a6a9254a1580699188413a7e7363af Mon Sep 17 00:00:00 2001
|
|
||||||
From: Elie ROUDNINSKI <xademax@gmail.com>
|
|
||||||
Date: Sun, 7 Oct 2018 18:02:24 +0100
|
|
||||||
Subject: [PATCH] Support custom c(cld)flags for CC(LD)_FOR_BUILD
|
|
||||||
|
|
||||||
---
|
|
||||||
Make.defaults | 11 +++++++++++
|
|
||||||
src/Makefile | 1 +
|
|
||||||
2 files changed, 12 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/Make.defaults b/Make.defaults
|
|
||||||
index 57cee6e..814b0ef 100644
|
|
||||||
--- a/Make.defaults
|
|
||||||
+++ b/Make.defaults
|
|
||||||
@@ -36,6 +36,11 @@ cflags = $(CFLAGS) -I${TOPDIR}/src/include/ \
|
|
||||||
$(if $(findstring ccc-analyzer,$(CC)),$(clang_cflags),) \
|
|
||||||
$(if $(findstring gcc,$(CC)),$(gcc_cflags),) \
|
|
||||||
$(call pkg-config-cflags)
|
|
||||||
+cflags_for_build = $(CFLAGS_FOR_BUILD) -I${TOPDIR}/src/include/ \
|
|
||||||
+ $(if $(findstring clang,$(CC_FOR_BUILD)),$(clang_cflags),) \
|
|
||||||
+ $(if $(findstring ccc-analyzer,$(CC_FOR_BUILD)),$(clang_cflags),) \
|
|
||||||
+ $(if $(findstring gcc,$(CC_FOR_BUILD)),$(gcc_cflags),) \
|
|
||||||
+ $(call pkg-config-cflags)
|
|
||||||
clang_ccldflags =
|
|
||||||
gcc_ccldflags =
|
|
||||||
ccldflags = $(cflags) -L. $(CCLDFLAGS) $(LDFLAGS) \
|
|
||||||
@@ -44,6 +49,12 @@ ccldflags = $(cflags) -L. $(CCLDFLAGS) $(LDFLAGS) \
|
|
||||||
$(if $(findstring ccc-analyzer,$(CCLD)),$(clang_ccldflags),) \
|
|
||||||
$(if $(findstring gcc,$(CCLD)),$(gcc_ccldflags),) \
|
|
||||||
$(call pkg-config-ldflags)
|
|
||||||
+ccldflags_for_build = $(cflags_for_build) -L. $(CCLDFLAGS) $(LDFLAGS) \
|
|
||||||
+ -Wl,-z,muldefs \
|
|
||||||
+ $(if $(findstring clang,$(CCLD_FOR_BUILD)),$(clang_ccldflags),) \
|
|
||||||
+ $(if $(findstring ccc-analyzer,$(CCLD_FOR_BUILD)),$(clang_ccldflags),) \
|
|
||||||
+ $(if $(findstring gcc,$(CCLD_FOR_BUILD)),$(gcc_ccldflags),) \
|
|
||||||
+ $(call pkg-config-ldflags)
|
|
||||||
SOFLAGS=-shared
|
|
||||||
LDLIBS=$(foreach lib,$(LIBS),-l$(lib)) $(call pkg-config-ldlibs)
|
|
||||||
|
|
||||||
diff --git a/src/Makefile b/src/Makefile
|
|
||||||
index 76bc474..287bb1d 100644
|
|
||||||
--- a/src/Makefile
|
|
||||||
+++ b/src/Makefile
|
|
||||||
@@ -56,6 +56,7 @@ makeguids : CPPFLAGS+=-DEFIVAR_BUILD_ENVIRONMENT
|
|
||||||
makeguids : LIBS=dl
|
|
||||||
makeguids : $(MAKEGUIDS_SOURCES)
|
|
||||||
makeguids : CCLD=$(CCLD_FOR_BUILD)
|
|
||||||
+makeguids : ccldflags=$(ccldflags_for_build)
|
|
||||||
|
|
||||||
guids.o : guids.S | guids.bin names.bin
|
|
||||||
|
|
||||||
--
|
|
||||||
2.19.0
|
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
From 9fc8c48fa59a6d7aaa4c7df7642bfd316086d3b7 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Elie ROUDNINSKI <xademax@gmail.com>
|
|
||||||
Date: Sun, 7 Oct 2018 18:38:47 +0100
|
|
||||||
Subject: [PATCH] Replace call to strncpy by memcpy to fix some GCC8 warnings
|
|
||||||
|
|
||||||
---
|
|
||||||
src/guid.h | 30 ++++++++++++++++++++----------
|
|
||||||
1 file changed, 20 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/guid.h b/src/guid.h
|
|
||||||
index d4a06f9..c03a362 100644
|
|
||||||
--- a/src/guid.h
|
|
||||||
+++ b/src/guid.h
|
|
||||||
@@ -103,7 +103,8 @@ text_to_guid(const char *text, efi_guid_t *guid)
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(eightbytes, text, 8);
|
|
||||||
+ memcpy(eightbytes, text, 8);
|
|
||||||
+ eightbytes[8] = 0;
|
|
||||||
if (check_segment_sanity(eightbytes, 8) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->a = (uint32_t)strtoul(eightbytes, NULL, 16);
|
|
||||||
@@ -111,7 +112,8 @@ text_to_guid(const char *text, efi_guid_t *guid)
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(fourbytes, text+9, 4);
|
|
||||||
+ memcpy(fourbytes, text+9, 4);
|
|
||||||
+ fourbytes[4] = 0;
|
|
||||||
if (check_segment_sanity(fourbytes, 4) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->b = (uint16_t)strtoul(fourbytes, NULL, 16);
|
|
||||||
@@ -119,7 +121,8 @@ text_to_guid(const char *text, efi_guid_t *guid)
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(fourbytes, text+14, 4);
|
|
||||||
+ memcpy(fourbytes, text+14, 4);
|
|
||||||
+ fourbytes[4] = 0;
|
|
||||||
if (check_segment_sanity(fourbytes, 4) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->c = (uint16_t)strtoul(fourbytes, NULL, 16);
|
|
||||||
@@ -127,7 +130,8 @@ text_to_guid(const char *text, efi_guid_t *guid)
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(fourbytes, text+19, 4);
|
|
||||||
+ memcpy(fourbytes, text+19, 4);
|
|
||||||
+ fourbytes[4] = 0;
|
|
||||||
if (check_segment_sanity(fourbytes, 4) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->d = (uint16_t)strtoul(fourbytes, NULL, 16);
|
|
||||||
@@ -135,42 +139,48 @@ text_to_guid(const char *text, efi_guid_t *guid)
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(twobytes, text+24, 2);
|
|
||||||
+ memcpy(twobytes, text+24, 2);
|
|
||||||
+ twobytes[2] = 0;
|
|
||||||
if (check_segment_sanity(twobytes, 2) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->e[0] = (uint8_t)strtoul(twobytes, NULL, 16);
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(twobytes, text+26, 2);
|
|
||||||
+ memcpy(twobytes, text+26, 2);
|
|
||||||
+ twobytes[2] = 0;
|
|
||||||
if (check_segment_sanity(twobytes, 2) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->e[1] = (uint8_t)strtoul(twobytes, NULL, 16);
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(twobytes, text+28, 2);
|
|
||||||
+ memcpy(twobytes, text+28, 2);
|
|
||||||
+ twobytes[2] = 0;
|
|
||||||
if (check_segment_sanity(twobytes, 2) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->e[2] = (uint8_t)strtoul(twobytes, NULL, 16);
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(twobytes, text+30, 2);
|
|
||||||
+ memcpy(twobytes, text+30, 2);
|
|
||||||
+ twobytes[2] = 0;
|
|
||||||
if (check_segment_sanity(twobytes, 2) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->e[3] = (uint8_t)strtoul(twobytes, NULL, 16);
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(twobytes, text+32, 2);
|
|
||||||
+ memcpy(twobytes, text+32, 2);
|
|
||||||
+ twobytes[2] = 0;
|
|
||||||
if (check_segment_sanity(twobytes, 2) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->e[4] = (uint8_t)strtoul(twobytes, NULL, 16);
|
|
||||||
|
|
||||||
/* 84be9c3e-8a32-42c0-891c-4cd3b072becc
|
|
||||||
* ^ */
|
|
||||||
- strncpy(twobytes, text+34, 2);
|
|
||||||
+ memcpy(twobytes, text+34, 2);
|
|
||||||
+ twobytes[2] = 0;
|
|
||||||
if (check_segment_sanity(twobytes, 2) < 0)
|
|
||||||
return -1;
|
|
||||||
guid->e[5] = (uint8_t)strtoul(twobytes, NULL, 16);
|
|
||||||
--
|
|
||||||
2.19.0
|
|
||||||
|
|
10
srcpkgs/efivar/patches/build-tester.patch
Normal file
10
srcpkgs/efivar/patches/build-tester.patch
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
--- a/src/Makefile
|
||||||
|
+++ b/src/Makefile
|
||||||
|
@@ -42,6 +42,7 @@
|
||||||
|
endif
|
||||||
|
|
||||||
|
all : $(TARGETS)
|
||||||
|
+ $(MAKE) -C test
|
||||||
|
|
||||||
|
static : $(STATICTARGETS)
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
From bc65d63ebf8fe6ac8a099ff15ca200986dba1565 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Robbie Harwood <rharwood@redhat.com>
|
|
||||||
Date: Thu, 28 Jul 2022 16:11:24 -0400
|
|
||||||
Subject: [PATCH] Fix glibc 2.36 build (mount.h conflicts)
|
|
||||||
|
|
||||||
glibc has decided that sys/mount.h and linux/mount.h are no longer
|
|
||||||
usable at the same time. This broke the build, since linux/fs.h itself
|
|
||||||
includes linux/mount.h. For now, fix the build by only including
|
|
||||||
sys/mount.h where we need it.
|
|
||||||
|
|
||||||
See-also: https://sourceware.org/glibc/wiki/Release/2.36#Usage_of_.3Clinux.2Fmount.h.3E_and_.3Csys.2Fmount.h.3E
|
|
||||||
Resolves: #227
|
|
||||||
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
|
||||||
---
|
|
||||||
src/gpt.c | 1 +
|
|
||||||
src/linux.c | 1 +
|
|
||||||
src/util.h | 1 -
|
|
||||||
3 files changed, 2 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/src/gpt.c b/src/gpt.c
|
|
||||||
index 1eda0497..21413c3b 100644
|
|
||||||
--- a/src/gpt.c
|
|
||||||
+++ b/src/gpt.c
|
|
||||||
@@ -17,6 +17,7 @@
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
+#include <sys/mount.h>
|
|
||||||
#include <sys/param.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/utsname.h>
|
|
||||||
diff --git a/src/linux.c b/src/linux.c
|
|
||||||
index 47e45ae4..1780816f 100644
|
|
||||||
--- a/src/linux.c
|
|
||||||
+++ b/src/linux.c
|
|
||||||
@@ -20,6 +20,7 @@
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
+#include <sys/mount.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <sys/sysmacros.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
diff --git a/src/util.h b/src/util.h
|
|
||||||
index 3300666f..1e67e447 100644
|
|
||||||
--- a/src/util.h
|
|
||||||
+++ b/src/util.h
|
|
||||||
@@ -23,7 +23,6 @@
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
-#include <sys/mount.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <tgmath.h>
|
|
46
srcpkgs/efivar/patches/lfs64.patch
Normal file
46
srcpkgs/efivar/patches/lfs64.patch
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
Patch-Source: https://github.com/rhboot/efivar/commit/914c686cc54b2405dab08bff77cd60827aab54b1
|
||||||
|
--
|
||||||
|
From 914c686cc54b2405dab08bff77cd60827aab54b1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Khem Raj <raj.khem@gmail.com>
|
||||||
|
Date: Wed, 14 Dec 2022 16:55:51 -0800
|
||||||
|
Subject: [PATCH] Use off_t instead of off64_t
|
||||||
|
|
||||||
|
Pass _FILE_OFFSET_BITS=64 to ensure 64bit off_t
|
||||||
|
|
||||||
|
This helps building efivar for 32bit arches on systems using musl C
|
||||||
|
library. It works with glibc since _GNU_SOURCE defines
|
||||||
|
_LARGEFILE64_SOURCE as well, this feature test macro enables the 64bit
|
||||||
|
interfaces which were done as intermediate steps when transition to
|
||||||
|
66-bit off_t was done as part olf LFS64 support.
|
||||||
|
|
||||||
|
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||||
|
---
|
||||||
|
src/error.c | 2 +-
|
||||||
|
src/include/defaults.mk | 1 +
|
||||||
|
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/error.c b/src/error.c
|
||||||
|
index fcbba0d6..9530e22c 100644
|
||||||
|
--- a/src/error.c
|
||||||
|
+++ b/src/error.c
|
||||||
|
@@ -191,7 +191,7 @@ dbglog_write(void *cookie, const char *buf, size_t size)
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
-dbglog_seek(void *cookie UNUSED, off64_t *offset, int whence)
|
||||||
|
+dbglog_seek(void *cookie UNUSED, off_t *offset, int whence)
|
||||||
|
{
|
||||||
|
FILE *log = efi_errlog ? efi_errlog : stderr;
|
||||||
|
int rc;
|
||||||
|
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
|
||||||
|
index 42bd3d6e..bb9c997f 100644
|
||||||
|
--- a/src/include/defaults.mk
|
||||||
|
+++ b/src/include/defaults.mk
|
||||||
|
@@ -34,6 +34,7 @@ CPPFLAGS ?=
|
||||||
|
override _CPPFLAGS := $(CPPFLAGS)
|
||||||
|
override CPPFLAGS = $(_CPPFLAGS) -DLIBEFIVAR_VERSION=$(VERSION) \
|
||||||
|
-D_GNU_SOURCE \
|
||||||
|
+ -D_FILE_OFFSET_BITS=64 \
|
||||||
|
-I$(TOPDIR)/src/include/
|
||||||
|
CFLAGS ?= $(OPTIMIZE) $(DEBUGINFO) $(WARNINGS) $(ERRORS)
|
||||||
|
CFLAGS_GCC ?= -specs=$(TOPDIR)/src/include/gcc.specs \
|
231
srcpkgs/efivar/patches/musl-compat.patch
Normal file
231
srcpkgs/efivar/patches/musl-compat.patch
Normal file
|
@ -0,0 +1,231 @@
|
||||||
|
From cece3ffd5be2f8641eb694513f2b73e5eb97ffd3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Natanael Copa <ncopa@alpinelinux.org>
|
||||||
|
Date: Fri, 28 Jan 2022 12:13:30 +0100
|
||||||
|
Subject: [PATCH 1/2] efisecdb: fix build with musl libc
|
||||||
|
|
||||||
|
Refactor code to use POSIX atexit(3) instead of the GNU specific
|
||||||
|
on_exit(3).
|
||||||
|
|
||||||
|
Resolves: #197
|
||||||
|
Resolves: #202
|
||||||
|
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
||||||
|
---
|
||||||
|
src/compiler.h | 2 --
|
||||||
|
src/efisecdb.c | 68 +++++++++++++++++++-------------------------------
|
||||||
|
2 files changed, 26 insertions(+), 44 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/compiler.h b/src/compiler.h
|
||||||
|
index e2f18f0b..d95fb014 100644
|
||||||
|
--- a/src/compiler.h
|
||||||
|
+++ b/src/compiler.h
|
||||||
|
@@ -7,8 +7,6 @@
|
||||||
|
#ifndef COMPILER_H_
|
||||||
|
#define COMPILER_H_
|
||||||
|
|
||||||
|
-#include <sys/cdefs.h>
|
||||||
|
-
|
||||||
|
/* GCC version checking borrowed from glibc. */
|
||||||
|
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
||||||
|
# define GNUC_PREREQ(maj,min) \
|
||||||
|
diff --git a/src/efisecdb.c b/src/efisecdb.c
|
||||||
|
index f8823737..6bd5ad90 100644
|
||||||
|
--- a/src/efisecdb.c
|
||||||
|
+++ b/src/efisecdb.c
|
||||||
|
@@ -25,6 +25,10 @@
|
||||||
|
extern char *optarg;
|
||||||
|
extern int optind, opterr, optopt;
|
||||||
|
|
||||||
|
+static efi_secdb_t *secdb = NULL;
|
||||||
|
+static list_t infiles;
|
||||||
|
+static list_t actions;
|
||||||
|
+
|
||||||
|
struct hash_param {
|
||||||
|
char *name;
|
||||||
|
efi_secdb_type_t algorithm;
|
||||||
|
@@ -187,12 +191,11 @@ add_action(list_t *list, action_type_t action_type, const efi_guid_t *owner,
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-free_actions(int status UNUSED, void *actionsp)
|
||||||
|
+free_actions(void)
|
||||||
|
{
|
||||||
|
- list_t *actions = (list_t *)actionsp;
|
||||||
|
list_t *pos, *tmp;
|
||||||
|
|
||||||
|
- for_each_action_safe(pos, tmp, actions) {
|
||||||
|
+ for_each_action_safe(pos, tmp, &actions) {
|
||||||
|
action_t *action = list_entry(pos, action_t, list);
|
||||||
|
|
||||||
|
list_del(&action->list);
|
||||||
|
@@ -202,12 +205,11 @@ free_actions(int status UNUSED, void *actionsp)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-free_infiles(int status UNUSED, void *infilesp)
|
||||||
|
+free_infiles(void)
|
||||||
|
{
|
||||||
|
- list_t *infiles = (list_t *)infilesp;
|
||||||
|
list_t *pos, *tmp;
|
||||||
|
|
||||||
|
- for_each_ptr_safe(pos, tmp, infiles) {
|
||||||
|
+ for_each_ptr_safe(pos, tmp, &infiles) {
|
||||||
|
ptrlist_t *entry = list_entry(pos, ptrlist_t, list);
|
||||||
|
|
||||||
|
list_del(&entry->list);
|
||||||
|
@@ -216,27 +218,12 @@ free_infiles(int status UNUSED, void *infilesp)
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
-maybe_free_secdb(int status UNUSED, void *voidp)
|
||||||
|
+maybe_free_secdb(void)
|
||||||
|
{
|
||||||
|
- efi_secdb_t **secdbp = (efi_secdb_t **)voidp;
|
||||||
|
-
|
||||||
|
- if (secdbp == NULL || *secdbp == NULL)
|
||||||
|
+ if (secdb == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- efi_secdb_free(*secdbp);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static void
|
||||||
|
-maybe_do_unlink(int status, void *filep)
|
||||||
|
-{
|
||||||
|
- char **file = (char **)filep;
|
||||||
|
-
|
||||||
|
- if (status == 0)
|
||||||
|
- return;
|
||||||
|
- if (file == NULL || *file == NULL)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
- unlink(*file);
|
||||||
|
+ efi_secdb_free(secdb);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
@@ -323,15 +310,6 @@ parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb,
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
-/*
|
||||||
|
- * These need to be static globals so that they're not on main's stack when
|
||||||
|
- * on_exit() fires.
|
||||||
|
- */
|
||||||
|
-static efi_secdb_t *secdb = NULL;
|
||||||
|
-static list_t infiles;
|
||||||
|
-static list_t actions;
|
||||||
|
-static char *outfile = NULL;
|
||||||
|
-
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
@@ -351,6 +329,7 @@ main(int argc, char *argv[])
|
||||||
|
bool do_sort_data = false;
|
||||||
|
bool sort_descending = false;
|
||||||
|
int status = 0;
|
||||||
|
+ char *outfile = NULL;
|
||||||
|
|
||||||
|
const char sopts[] = ":aAc:dfg:h:i:Lo:rs:t:v?";
|
||||||
|
const struct option lopts[] = {
|
||||||
|
@@ -376,10 +355,9 @@ main(int argc, char *argv[])
|
||||||
|
INIT_LIST_HEAD(&infiles);
|
||||||
|
INIT_LIST_HEAD(&actions);
|
||||||
|
|
||||||
|
- on_exit(free_actions, &actions);
|
||||||
|
- on_exit(free_infiles, &infiles);
|
||||||
|
- on_exit(maybe_free_secdb, &secdb);
|
||||||
|
- on_exit(maybe_do_unlink, &outfile);
|
||||||
|
+ atexit(free_actions);
|
||||||
|
+ atexit(free_infiles);
|
||||||
|
+ atexit(maybe_free_secdb);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* parse the command line.
|
||||||
|
@@ -587,24 +565,30 @@ main(int argc, char *argv[])
|
||||||
|
outfd = open(outfile, flags, 0600);
|
||||||
|
if (outfd < 0) {
|
||||||
|
char *tmpoutfile = outfile;
|
||||||
|
- if (errno == EEXIST)
|
||||||
|
- outfile = NULL;
|
||||||
|
+ if (errno != EEXIST)
|
||||||
|
+ unlink(outfile);
|
||||||
|
err(1, "could not open \"%s\"", tmpoutfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = ftruncate(outfd, 0);
|
||||||
|
- if (rc < 0)
|
||||||
|
+ if (rc < 0) {
|
||||||
|
+ unlink(outfile);
|
||||||
|
err(1, "could not truncate output file \"%s\"", outfile);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
void *output;
|
||||||
|
size_t size = 0;
|
||||||
|
rc = efi_secdb_realize(secdb, &output, &size);
|
||||||
|
- if (rc < 0)
|
||||||
|
+ if (rc < 0) {
|
||||||
|
+ unlink(outfile);
|
||||||
|
secdb_err(1, "could not realize signature list");
|
||||||
|
+ }
|
||||||
|
|
||||||
|
rc = write(outfd, output, size);
|
||||||
|
- if (rc < 0)
|
||||||
|
+ if (rc < 0) {
|
||||||
|
+ unlink(outfile);
|
||||||
|
err(1, "could not write signature list");
|
||||||
|
+ }
|
||||||
|
|
||||||
|
close(outfd);
|
||||||
|
xfree(output);
|
||||||
|
|
||||||
|
From df09b472419466987f2f30176dd00937e640aa9a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Natanael Copa <ncopa@alpinelinux.org>
|
||||||
|
Date: Fri, 28 Jan 2022 12:29:00 +0100
|
||||||
|
Subject: [PATCH 2/2] efisecdb: do not free optarg
|
||||||
|
|
||||||
|
The *outfile passed to parse_input_files can only be either set to
|
||||||
|
optarg or be NULL. optarg should not be free'd and NULL does not need
|
||||||
|
to.
|
||||||
|
|
||||||
|
Since we no longer use on_exit to unlink outfile we also don't need to
|
||||||
|
set *outfile to NULL.
|
||||||
|
|
||||||
|
Fixes commit d91787035bc1 (efisecdb: add efisecdb)
|
||||||
|
|
||||||
|
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
||||||
|
---
|
||||||
|
src/efisecdb.c | 7 ++-----
|
||||||
|
1 file changed, 2 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/efisecdb.c b/src/efisecdb.c
|
||||||
|
index 6bd5ad90..70fa1847 100644
|
||||||
|
--- a/src/efisecdb.c
|
||||||
|
+++ b/src/efisecdb.c
|
||||||
|
@@ -255,8 +255,7 @@ list_guids(void)
|
||||||
|
* failure.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
-parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb,
|
||||||
|
- bool dump)
|
||||||
|
+parse_input_files(list_t *infiles, efi_secdb_t **secdb, bool dump)
|
||||||
|
{
|
||||||
|
int status = 0;
|
||||||
|
list_t *pos, *tmp;
|
||||||
|
@@ -297,8 +296,6 @@ parse_input_files(list_t *infiles, char **outfile, efi_secdb_t **secdb,
|
||||||
|
if (!dump)
|
||||||
|
exit(1);
|
||||||
|
status = 1;
|
||||||
|
- xfree(*outfile);
|
||||||
|
- *outfile = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -528,7 +525,7 @@ main(int argc, char *argv[])
|
||||||
|
efi_secdb_set_bool(secdb, EFI_SECDB_SORT_DATA, do_sort_data);
|
||||||
|
efi_secdb_set_bool(secdb, EFI_SECDB_SORT_DESCENDING, sort_descending);
|
||||||
|
|
||||||
|
- status = parse_input_files(&infiles, &outfile, &secdb, dump);
|
||||||
|
+ status = parse_input_files(&infiles, &secdb, dump);
|
||||||
|
if (status == 0) {
|
||||||
|
for_each_action_safe(pos, tmp, &actions) {
|
||||||
|
action_t *action = list_entry(pos, action_t, list);
|
|
@ -1,23 +1,39 @@
|
||||||
# Template file for 'efivar'
|
# Template file for 'efivar'
|
||||||
pkgname=efivar
|
pkgname=efivar
|
||||||
version=37
|
version=38
|
||||||
revision=2
|
revision=1
|
||||||
build_style=gnu-makefile
|
build_style=gnu-makefile
|
||||||
make_build_args="libdir=/usr/lib"
|
make_build_args="libdir=/usr/lib"
|
||||||
make_build_target="all test"
|
make_check_args="GRUB_PREFIX=grub"
|
||||||
|
make_check_target="test"
|
||||||
make_install_args="libdir=/usr/lib"
|
make_install_args="libdir=/usr/lib"
|
||||||
hostmakedepends="pkg-config"
|
hostmakedepends="pkg-config mdocml"
|
||||||
|
checkdepends="grub"
|
||||||
short_desc="Tools to manipulate EFI variables"
|
short_desc="Tools to manipulate EFI variables"
|
||||||
maintainer="Orphaned <orphan@voidlinux.org>"
|
maintainer="Orphaned <orphan@voidlinux.org>"
|
||||||
license="LGPL-2.1-or-later"
|
license="LGPL-2.1-or-later"
|
||||||
homepage="https://github.com/rhinstaller/efivar"
|
homepage="https://github.com/rhboot/efivar"
|
||||||
distfiles="https://github.com/rhboot/efivar/releases/download/${version}/efivar-${version}.tar.bz2"
|
distfiles="https://github.com/rhboot/efivar/releases/download/${version}/efivar-${version}.tar.bz2"
|
||||||
checksum=3c67feb93f901b98fbb897d5ca82931a6698b5bcd6ac34f0815f670d77747b9f
|
checksum=f018ed6e49c5f1c16d336d9fd7687ce87023276591921db1e49a314ad6515349
|
||||||
|
|
||||||
CFLAGS="-D_GNU_SOURCE -Wno-error=address-of-packed-member"
|
disable_parallel_check=yes
|
||||||
|
|
||||||
post_build() {
|
post_extract() {
|
||||||
make -C src/test
|
vsed -e 's/-march=native//' -i src/include/defaults.mk
|
||||||
|
if [ "$CROSS_BUILD" ]; then
|
||||||
|
# we build makeguids manually, make sure its not rebuild
|
||||||
|
vsed -e '/$(MAKEGUIDS_OUTPUT) : makeguids/d' -i src/Makefile
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
pre_build() {
|
||||||
|
if [ "$CROSS_BUILD" ]; then
|
||||||
|
# work around broken cross build support by building makeguids
|
||||||
|
# and then cleaning up shared objects.
|
||||||
|
make ${makejobs} -C src makeguids HOSTCC=gcc HOSTCCLD=gcc \
|
||||||
|
HOST_CFLAGS= HOST_LDFLAGS= SRCDIR=${wrksrc} TOPDIR=${wrksrc}
|
||||||
|
rm -f src/*.o
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
post_install() {
|
post_install() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue