#include <errno.h>
#include <stdio.h>
-#include <stdio_ext.h>
#include <sys/prctl.h>
#include <sys/xattr.h>
#include <unistd.h>
#include "log.h"
#include "macro.h"
#include "main-func.h"
+#include "memory-util.h"
#include "missing.h"
#include "mkdir.h"
#include "parse-util.h"
#include "strv.h"
#include "tmpfile-util.h"
#include "user-util.h"
-#include "util.h"
/* The maximum size up to which we process coredumps */
#define PROCESS_SIZE_MAX ((uint64_t) (2LLU*1024LLU*1024LLU*1024LLU))
if (r < 0)
return log_error_errno(r, "Failed to determine coredump file name: %m");
- mkdir_p_label("/var/lib/systemd/coredump", 0755);
+ (void) mkdir_p_label("/var/lib/systemd/coredump", 0755);
fd = open_tmpfile_linkable(fn, O_RDWR|O_CLOEXEC, &tmp);
if (fd < 0)
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;
if (r < 0)
return r;
- r = get_process_cmdline(container_pid, 0, false, cmdline);
+ r = get_process_cmdline(container_pid, SIZE_MAX, 0, cmdline);
if (r < 0)
return r;
return log_error_errno(r, "Failed to drop privileges: %m");
#if HAVE_ELFUTILS
- /* Try to get a strack trace if we can */
+ /* Try to get a stack trace if we can */
if (coredump_size <= arg_process_size_max) {
_cleanup_free_ char *stacktrace = NULL;
* (truncated) copy of what we want to send, and the second one
* contains the trailing dots. */
copy[0] = iovec[i];
- copy[1] = (struct iovec) {
- .iov_base = (char[]) { '.', '.', '.' },
- .iov_len = 3,
- };
+ copy[1] = IOVEC_MAKE(((char[]){'.', '.', '.'}), 3);
mh.msg_iov = copy;
mh.msg_iovlen = 2;
if (sd_pid_get_slice(pid, &t) >= 0)
set_iovec_field_free(iovec, n_iovec, "COREDUMP_SLICE=", t);
- if (get_process_cmdline(pid, 0, false, &t) >= 0)
+ if (get_process_cmdline(pid, SIZE_MAX, 0, &t) >= 0)
set_iovec_field_free(iovec, n_iovec, "COREDUMP_CMDLINE=", t);
if (cg_pid_get_path_shifted(pid, NULL, &t) >= 0)