lvm2: update to 2.02.166.
Guard buffer wrangling with __GLIBC__.
This commit is contained in:
parent
a5c7d868b9
commit
ded1fe9d2d
|
@ -1,85 +1,3 @@
|
||||||
--- lib/commands/toolcontext.c
|
|
||||||
+++ lib/commands/toolcontext.c
|
|
||||||
@@ -1336,7 +1336,10 @@
|
|
||||||
/*
|
|
||||||
* Close and reopen stream on file descriptor fd.
|
|
||||||
*/
|
|
||||||
-static int _reopen_stream(FILE *stream, int fd, const char *mode, const char *name, FILE **new_stream)
|
|
||||||
+#ifdef __GLIBC__
|
|
||||||
+#define _reopen_stream(stream, fd, mode, name) __reopen_stream(stream, fd, mode, name, &stream)
|
|
||||||
+
|
|
||||||
+static int __reopen_stream(FILE *stream, int fd, const char *mode, const char *name, FILE **new_stream)
|
|
||||||
{
|
|
||||||
int fd_copy, new_fd;
|
|
||||||
|
|
||||||
@@ -1363,6 +1366,9 @@
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
+#else
|
|
||||||
+#define _reopen_stream(stream, fd, mode, name) (freopen(NULL, mode, stream) != NULL)
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
/* Entry point */
|
|
||||||
struct cmd_context *create_toolcontext(unsigned is_long_lived,
|
|
||||||
@@ -1371,7 +1377,6 @@
|
|
||||||
unsigned threaded)
|
|
||||||
{
|
|
||||||
struct cmd_context *cmd;
|
|
||||||
- FILE *new_stream;
|
|
||||||
int flags;
|
|
||||||
|
|
||||||
#ifdef M_MMAP_MAX
|
|
||||||
@@ -1421,9 +1426,8 @@
|
|
||||||
if (is_valid_fd(STDIN_FILENO) &&
|
|
||||||
((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) &&
|
|
||||||
(flags & O_ACCMODE) != O_WRONLY) {
|
|
||||||
- if (!_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream))
|
|
||||||
+ if (!_reopen_stream(stdin, STDIN_FILENO, "r", "stdin"))
|
|
||||||
goto_out;
|
|
||||||
- stdin = new_stream;
|
|
||||||
if (setvbuf(stdin, cmd->linebuffer, _IOLBF, linebuffer_size)) {
|
|
||||||
log_sys_error("setvbuf", "");
|
|
||||||
goto out;
|
|
||||||
@@ -1433,9 +1437,8 @@
|
|
||||||
if (is_valid_fd(STDOUT_FILENO) &&
|
|
||||||
((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) &&
|
|
||||||
(flags & O_ACCMODE) != O_RDONLY) {
|
|
||||||
- if (!_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream))
|
|
||||||
+ if (!_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout"))
|
|
||||||
goto_out;
|
|
||||||
- stdout = new_stream;
|
|
||||||
if (setvbuf(stdout, cmd->linebuffer + linebuffer_size,
|
|
||||||
_IOLBF, linebuffer_size)) {
|
|
||||||
log_sys_error("setvbuf", "");
|
|
||||||
@@ -1715,7 +1718,6 @@
|
|
||||||
void destroy_toolcontext(struct cmd_context *cmd)
|
|
||||||
{
|
|
||||||
struct dm_config_tree *cft_cmdline;
|
|
||||||
- FILE *new_stream;
|
|
||||||
int flags;
|
|
||||||
|
|
||||||
if (cmd->dump_filter && cmd->filter && cmd->filter->dump &&
|
|
||||||
@@ -1752,8 +1754,7 @@
|
|
||||||
if (is_valid_fd(STDIN_FILENO) &&
|
|
||||||
((flags = fcntl(STDIN_FILENO, F_GETFL)) > 0) &&
|
|
||||||
(flags & O_ACCMODE) != O_WRONLY) {
|
|
||||||
- if (_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream)) {
|
|
||||||
- stdin = new_stream;
|
|
||||||
+ if (_reopen_stream(stdin, STDIN_FILENO, "r", "stdin")) {
|
|
||||||
setlinebuf(stdin);
|
|
||||||
} else
|
|
||||||
cmd->linebuffer = NULL; /* Leave buffer in place (deliberate leak) */
|
|
||||||
@@ -1762,8 +1763,7 @@
|
|
||||||
if (is_valid_fd(STDOUT_FILENO) &&
|
|
||||||
((flags = fcntl(STDOUT_FILENO, F_GETFL)) > 0) &&
|
|
||||||
(flags & O_ACCMODE) != O_RDONLY) {
|
|
||||||
- if (_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream)) {
|
|
||||||
- stdout = new_stream;
|
|
||||||
+ if (_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout")) {
|
|
||||||
setlinebuf(stdout);
|
|
||||||
} else
|
|
||||||
cmd->linebuffer = NULL; /* Leave buffer in place (deliberate leak) */
|
|
||||||
--- tools/lvmcmdline.c
|
--- tools/lvmcmdline.c
|
||||||
+++ tools/lvmcmdline.c
|
+++ tools/lvmcmdline.c
|
||||||
@@ -1252,7 +1252,7 @@
|
@@ -1252,7 +1252,7 @@
|
||||||
|
@ -109,3 +27,23 @@
|
||||||
printf("stderr stream open: %s\n",
|
printf("stderr stream open: %s\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return 0;
|
return 0;
|
||||||
|
--- lib/commands/toolcontext.c.orig
|
||||||
|
+++ lib/commands/toolcontext.c
|
||||||
|
@@ -1860,7 +1860,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) {
|
||||||
|
/* Allocate 2 buffers */
|
||||||
|
@@ -2241,7 +2241,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) &&
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Template file for 'lvm2'
|
# Template file for 'lvm2'
|
||||||
pkgname=lvm2
|
pkgname=lvm2
|
||||||
version=2.02.162
|
version=2.02.166
|
||||||
revision=1
|
revision=1
|
||||||
wrksrc="LVM2.${version}"
|
wrksrc="LVM2.${version}"
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
|
@ -22,7 +22,7 @@ maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
||||||
homepage="http://sourceware.org/lvm2/"
|
homepage="http://sourceware.org/lvm2/"
|
||||||
license="GPL-2, LGPL-2.1"
|
license="GPL-2, LGPL-2.1"
|
||||||
distfiles="ftp://sources.redhat.com/pub/lvm2/LVM2.${version}.tgz"
|
distfiles="ftp://sources.redhat.com/pub/lvm2/LVM2.${version}.tgz"
|
||||||
checksum=5d2ee0820de37185b2d289d85913a4f58a8cfbf37579acfe9dab35735ca6b4ed
|
checksum=e120b066b85b224552efda40204488c5123de068725676fd6e5c8bc655051b94
|
||||||
|
|
||||||
post_install() {
|
post_install() {
|
||||||
sed -i 's,use_lvmetad = 1,use_lvmetad = 0,' ${DESTDIR}/etc/lvm/lvm.conf
|
sed -i 's,use_lvmetad = 1,use_lvmetad = 0,' ${DESTDIR}/etc/lvm/lvm.conf
|
||||||
|
|
Loading…
Reference in New Issue