From 2fe21124a6560fcf1ce3b0a3004baa9bb45d1e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 4 Apr 2019 11:46:44 +0200 Subject: Add open_memstream_unlocked() wrapper --- src/coredump/coredump.c | 5 +---- src/coredump/stacktrace.c | 6 ++---- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'src/coredump') diff --git a/src/coredump/coredump.c b/src/coredump/coredump.c index 023701646b..ac7b972026 100644 --- a/src/coredump/coredump.c +++ b/src/coredump/coredump.c @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -530,12 +529,10 @@ static int compose_open_fds(pid_t pid, char **open_fds) { if (proc_fdinfo_fd < 0) return -errno; - stream = open_memstream(&buffer, &size); + stream = open_memstream_unlocked(&buffer, &size); if (!stream) return -ENOMEM; - (void) __fsetlocking(stream, FSETLOCKING_BYCALLER); - FOREACH_DIRENT(dent, proc_fd_dir, return -errno) { _cleanup_fclose_ FILE *fdinfo = NULL; _cleanup_free_ char *fdname = NULL; diff --git a/src/coredump/stacktrace.c b/src/coredump/stacktrace.c index ab1ac12a23..66b2ec8cca 100644 --- a/src/coredump/stacktrace.c +++ b/src/coredump/stacktrace.c @@ -2,11 +2,11 @@ #include #include -#include #include #include #include "alloc-util.h" +#include "fileio.h" #include "fd-util.h" #include "format-util.h" #include "macro.h" @@ -126,12 +126,10 @@ int coredump_make_stack_trace(int fd, const char *executable, char **ret) { if (lseek(fd, 0, SEEK_SET) == (off_t) -1) return -errno; - c.f = open_memstream(&buf, &sz); + c.f = open_memstream_unlocked(&buf, &sz); if (!c.f) return -ENOMEM; - (void) __fsetlocking(c.f, FSETLOCKING_BYCALLER); - elf_version(EV_CURRENT); c.elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); -- cgit v1.2.3