SHA256
1
0
forked from pool/systemd
systemd/0002-manager-flush-memory-stream-before-using-the-buffer.patch

46 lines
1.7 KiB
Diff
Raw Normal View History

Accepting request 225960 from Base:System - Add patch getty-generator-with-serial-3270-tty.patch to avoid harmless error messages on not existing getty@3270 files - Replace systemd-big-endian-reply-matching.patch with upstream 0001-sd-bus-don-t-look-for-a-64bit-value-when-we-only-hav.patch to solve broken systemd communication with and over dbus (bnc#866732) - Readd patch 1008-add-msft-compability-rules.patch for older code base as 13.1 - Modify pre_checkin.sh to throw an error if a patch will be applied which modifies one of Makefile.am, Makefile.in, or configiure.ac as this breaks bootstrapping - Add second version of make-209-working-on-older-dist.patch to be able to apply for bootstrapping version - Don't require non-existing binutils-gold - Avoid file conflict between udev and systemd (bnc#868230) - Modify patch module-load-handle-SUSE-etc-sysconfig-kernel-module-list.patch to ignore if /etc/sysconfig/kernel does not exist (bnc#865834) - Add patch systemd-big-endian-reply-matching.patch make sure that systemd can talk with dbus-daemon even on big endian systems (bnc#866732) ----------------------------------------------------------------- - Due to previous reason, resurrect systemd-dbus-system-bus-address.patch - Removed pkgconfig(dbus-1) BuildRequires - with 209 and newer, itis only needed for quering default DBus directories, which we nowpass to configure. OBS-URL: https://build.opensuse.org/request/show/225960 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=178
2014-03-18 16:21:15 +01:00
From b2cdc6664ef6b56e47d38649d69b9943d9f9f5d0 Mon Sep 17 00:00:00 2001
From: Daniel Mack <zonque@gmail.com>
Date: Fri, 7 Mar 2014 14:43:59 +0100
Subject: [PATCH] manager: flush memory stream before using the buffer
When the manager receives a SIGUSR2 signal, it opens a memory stream
with open_memstream(), uses the returned file handle for logging, and
dumps the logged content with log_dump().
However, the char* buffer is only safe to use after the file handle has
been flushed with fflush, as the man pages states:
When the stream is closed (fclose(3)) or flushed (fflush(3)), the
locations pointed to by ptr and sizeloc are updated to contain,
respectively, a pointer to the buffer and the current size of the
buffer.
These values remain valid only as long as the caller performs no
further output on the stream. If further output is performed, then the
stream must again be flushed before trying to access these variables.
Without that call, dump remains NULL and the daemon crashes in
log_dump().
---
src/core/manager.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git src/core/manager.c src/core/manager.c
index 27a1cc6..78f4f3d 100644
--- src/core/manager.c
+++ src/core/manager.c
@@ -1621,6 +1621,11 @@ static int manager_dispatch_signal_fd(sd_event_source *source, int fd, uint32_t
break;
}
+ if (fflush(f)) {
+ log_warning("Failed to flush status stream");
+ break;
+ }
+
log_dump(LOG_INFO, dump);
break;
}
--
1.7.9.2