diff core/lvm2/patch-musl.patch @ 667:1e35a4ddd0f4

core/lvm2: fix build with busybox patch
author David Demelier <markand@malikania.fr>
date Wed, 31 Jul 2019 20:00:00 +0200
parents core/lvm2/musl.patch@11b453a08c70
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/lvm2/patch-musl.patch	Wed Jul 31 20:00:00 2019 +0200
@@ -0,0 +1,71 @@
+--- libdaemon/server/daemon-server.c.orig
++++ libdaemon/server/daemon-server.c
+@@ -14,6 +14,7 @@
+ #include "daemon-server.h"
+ #include "daemon-log.h"
+ 
++#include <fcntl.h>
+ #include <dlfcn.h>
+ #include <errno.h>
+ #include <pthread.h>
+
+--- lib/mm/memlock.c.orig
++++ lib/mm/memlock.c
+@@ -150,7 +150,7 @@ static void _touch_memory(void *mem, siz
+ 
+ static void _allocate_memory(void)
+ {
+-#ifndef VALGRIND_POOL
++#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
+ 	void *stack_mem;
+ 	struct rlimit limit;
+ 	int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
+--- tools/lvmcmdline.c
++++ tools/lvmcmdline.c
+@@ -1252,7 +1252,7 @@
+ 	int err = is_valid_fd(STDERR_FILENO);
+ 
+ 	if (!is_valid_fd(STDIN_FILENO) &&
+-	    !(stdin = fopen(_PATH_DEVNULL, "r"))) {
++	    !freopen(_PATH_DEVNULL, "r", stdin)) {
+ 		if (err)
+ 			perror("stdin stream open");
+ 		else
+@@ -1262,7 +1262,7 @@
+ 	}
+ 
+ 	if (!is_valid_fd(STDOUT_FILENO) &&
+-	    !(stdout = fopen(_PATH_DEVNULL, "w"))) {
++	    !freopen(_PATH_DEVNULL, "w", stdout)) {
+ 		if (err)
+ 			perror("stdout stream open");
+ 		/* else no stdout */
+@@ -1270,7 +1270,7 @@
+ 	}
+ 
+ 	if (!is_valid_fd(STDERR_FILENO) &&
+-	    !(stderr = fopen(_PATH_DEVNULL, "w"))) {
++	    !freopen(_PATH_DEVNULL, "w", stderr)) {
+ 		printf("stderr stream open: %s\n",
+ 		       strerror(errno));
+ 		return 0;
+--- lib/commands/toolcontext.c.orig	2019-07-31 05:55:55.308887587 +0000
++++ lib/commands/toolcontext.c	2019-07-31 05:56:42.860889048 +0000
+@@ -1862,7 +1862,7 @@
+ 	/* FIXME Make this configurable? */
+ 	reset_lvm_errno(1);
+ 
+-#ifndef VALGRIND_POOL
++#if defined(VALGRIND_POOL) && defined(__GLIBC__)
+ 	/* Set in/out stream buffering before glibc */
+ 	if (set_buffering
+ #ifdef SYS_gettid
+@@ -2256,7 +2256,7 @@
+ 	if (cmd->libmem)
+ 		dm_pool_destroy(cmd->libmem);
+ 
+-#ifndef VALGRIND_POOL
++#if defined(VALGRIND_POOL) && defined(__GLIBC__)
+ 	if (cmd->linebuffer) {
+ 		/* Reset stream buffering to defaults */
+ 		if (is_valid_fd(STDIN_FILENO) &&