chiark / gitweb /
remove DISTRO_PORTING
[elogind.git] / src / journal / coredump.c
index f6b95145d20d22bd8fd33c13c09a966cd1e44007..4e23e487fbbe55d735f22f8a5173ec261edab350 100644 (file)
@@ -23,7 +23,6 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <sys/prctl.h>
-#include <sys/types.h>
 #include <sys/xattr.h>
 
 #ifdef HAVE_ELFUTILS
@@ -44,7 +43,6 @@
 #include "conf-parser.h"
 #include "copy.h"
 #include "stacktrace.h"
-#include "path-util.h"
 #include "compress.h"
 #include "acl-util.h"
 #include "capability.h"
@@ -244,7 +242,7 @@ static int maybe_remove_external_coredump(const char *filename, off_t size) {
 
 static int make_filename(const char *info[_INFO_LEN], char **ret) {
         _cleanup_free_ char *c = NULL, *u = NULL, *p = NULL, *t = NULL;
-        sd_id128_t boot;
+        sd_id128_t boot = {};
         int r;
 
         assert(info);
@@ -634,11 +632,11 @@ int main(int argc, char* argv[]) {
                         goto finish;
                 }
 
-                core_unit = strappenda("COREDUMP_UNIT=", t);
+                core_unit = strjoina("COREDUMP_UNIT=", t);
                 free(t);
 
         } else if (cg_pid_get_user_unit(pid, &t) >= 0) {
-                core_unit = strappenda("COREDUMP_USER_UNIT=", t);
+                core_unit = strjoina("COREDUMP_USER_UNIT=", t);
                 free(t);
         }
 
@@ -650,20 +648,20 @@ int main(int argc, char* argv[]) {
         log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
         log_open();
 
-        core_pid = strappenda("COREDUMP_PID=", info[INFO_PID]);
+        core_pid = strjoina("COREDUMP_PID=", info[INFO_PID]);
         IOVEC_SET_STRING(iovec[j++], core_pid);
 
-        core_uid = strappenda("COREDUMP_UID=", info[INFO_UID]);
+        core_uid = strjoina("COREDUMP_UID=", info[INFO_UID]);
         IOVEC_SET_STRING(iovec[j++], core_uid);
 
-        core_gid = strappenda("COREDUMP_GID=", info[INFO_GID]);
+        core_gid = strjoina("COREDUMP_GID=", info[INFO_GID]);
         IOVEC_SET_STRING(iovec[j++], core_gid);
 
-        core_signal = strappenda("COREDUMP_SIGNAL=", info[INFO_SIGNAL]);
+        core_signal = strjoina("COREDUMP_SIGNAL=", info[INFO_SIGNAL]);
         IOVEC_SET_STRING(iovec[j++], core_signal);
 
         if (sd_pid_get_session(pid, &t) >= 0) {
-                core_session = strappenda("COREDUMP_SESSION=", t);
+                core_session = strjoina("COREDUMP_SESSION=", t);
                 free(t);
 
                 IOVEC_SET_STRING(iovec[j++], core_session);
@@ -677,31 +675,31 @@ int main(int argc, char* argv[]) {
         }
 
         if (sd_pid_get_slice(pid, &t) >= 0) {
-                core_slice = strappenda("COREDUMP_SLICE=", t);
+                core_slice = strjoina("COREDUMP_SLICE=", t);
                 free(t);
 
                 IOVEC_SET_STRING(iovec[j++], core_slice);
         }
 
         if (comm) {
-                core_comm = strappenda("COREDUMP_COMM=", comm);
+                core_comm = strjoina("COREDUMP_COMM=", comm);
                 IOVEC_SET_STRING(iovec[j++], core_comm);
         }
 
         if (exe) {
-                core_exe = strappenda("COREDUMP_EXE=", exe);
+                core_exe = strjoina("COREDUMP_EXE=", exe);
                 IOVEC_SET_STRING(iovec[j++], core_exe);
         }
 
         if (get_process_cmdline(pid, 0, false, &t) >= 0) {
-                core_cmdline = strappenda("COREDUMP_CMDLINE=", t);
+                core_cmdline = strjoina("COREDUMP_CMDLINE=", t);
                 free(t);
 
                 IOVEC_SET_STRING(iovec[j++], core_cmdline);
         }
 
         if (cg_pid_get_path_shifted(pid, NULL, &t) >= 0) {
-                core_cgroup = strappenda("COREDUMP_CGROUP=", t);
+                core_cgroup = strjoina("COREDUMP_CGROUP=", t);
                 free(t);
 
                 IOVEC_SET_STRING(iovec[j++], core_cgroup);
@@ -752,14 +750,14 @@ int main(int argc, char* argv[]) {
         }
 
         if (get_process_cwd(pid, &t) >= 0) {
-                core_cwd = strappenda("COREDUMP_CWD=", t);
+                core_cwd = strjoina("COREDUMP_CWD=", t);
                 free(t);
 
                 IOVEC_SET_STRING(iovec[j++], core_cwd);
         }
 
         if (get_process_root(pid, &t) >= 0) {
-                core_root = strappenda("COREDUMP_ROOT=", t);
+                core_root = strjoina("COREDUMP_ROOT=", t);
                 free(t);
 
                 IOVEC_SET_STRING(iovec[j++], core_root);
@@ -799,7 +797,7 @@ int main(int argc, char* argv[]) {
         if (r == 0) {
                 const char *coredump_filename;
 
-                coredump_filename = strappenda("COREDUMP_FILENAME=", filename);
+                coredump_filename = strjoina("COREDUMP_FILENAME=", filename);
                 IOVEC_SET_STRING(iovec[j++], coredump_filename);
         }
 
@@ -843,7 +841,7 @@ log:
         /* Optionally store the entire coredump in the journal */
         if (IN_SET(arg_storage, COREDUMP_STORAGE_JOURNAL, COREDUMP_STORAGE_BOTH) &&
             coredump_size <= (off_t) arg_journal_size_max) {
-                size_t sz;
+                size_t sz = 0;
 
                 /* Store the coredump itself in the journal */