chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
localed: log xkbcommon errors
[elogind.git]
/
src
/
journal
/
coredumpctl.c
diff --git
a/src/journal/coredumpctl.c
b/src/journal/coredumpctl.c
index edc12fead6dba20a40012d369425f438c8743e0e..a6551ac44b21a027e26c91c51d0d0168f5138996 100644
(file)
--- a/
src/journal/coredumpctl.c
+++ b/
src/journal/coredumpctl.c
@@
-116,8
+116,7
@@
static int add_match(Set *set, const char *match) {
return 0;
fail:
return 0;
fail:
- log_error_errno(r, "Failed to add match: %m");
- return r;
+ return log_error_errno(r, "Failed to add match: %m");
}
static void help(void) {
}
static void help(void) {
@@
-191,10
+190,8
@@
static int parse_argv(int argc, char *argv[], Set *matches) {
}
output = fopen(optarg, "we");
}
output = fopen(optarg, "we");
- if (!output) {
- log_error("writing to '%s': %m", optarg);
- return -errno;
- }
+ if (!output)
+ return log_error_errno(errno, "writing to '%s': %m", optarg);
break;
break;
@@
-326,10
+323,8
@@
static int print_list(FILE* file, sd_journal *j, int had_legend) {
}
r = sd_journal_get_realtime_usec(j, &t);
}
r = sd_journal_get_realtime_usec(j, &t);
- if (r < 0) {
- log_error_errno(r, "Failed to get realtime timestamp: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to get realtime timestamp: %m");
format_timestamp(buf, sizeof(buf), t);
present = filename && access(filename, F_OK) == 0;
format_timestamp(buf, sizeof(buf), t);
present = filename && access(filename, F_OK) == 0;
@@
-521,10
+516,8
@@
static int focus(sd_journal *j) {
r = sd_journal_seek_tail(j);
if (r == 0)
r = sd_journal_previous(j);
r = sd_journal_seek_tail(j);
if (r == 0)
r = sd_journal_previous(j);
- if (r < 0) {
- log_error_errno(r, "Failed to search journal: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to search journal: %m");
if (r == 0) {
log_error("No match found.");
return -ESRCH;
if (r == 0) {
log_error("No match found.");
return -ESRCH;
@@
-614,10
+607,8
@@
static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
return log_oom();
fdt = mkostemp_safe(temp, O_WRONLY|O_CLOEXEC);
return log_oom();
fdt = mkostemp_safe(temp, O_WRONLY|O_CLOEXEC);
- if (fdt < 0) {
- log_error("Failed to create temporary file: %m");
- return -errno;
- }
+ if (fdt < 0)
+ return log_error_errno(errno, "Failed to create temporary file: %m");
log_debug("Created temporary file %s", temp);
fd = fdt;
log_debug("Created temporary file %s", temp);
fd = fdt;
@@
-633,7
+624,7
@@
static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
sz = write(fdt, data, len);
if (sz < 0) {
sz = write(fdt, data, len);
if (sz < 0) {
- log_error
(
"Failed to write temporary file: %m");
+ log_error
_errno(errno,
"Failed to write temporary file: %m");
r = -errno;
goto error;
}
r = -errno;
goto error;
}
@@
-648,7
+639,7
@@
static int save_core(sd_journal *j, int fd, char **path, bool *unlink_temp) {
fdf = open(filename, O_RDONLY | O_CLOEXEC);
if (fdf < 0) {
fdf = open(filename, O_RDONLY | O_CLOEXEC);
if (fdf < 0) {
- log_error
(
"Failed to open %s: %m", filename);
+ log_error
_errno(errno,
"Failed to open %s: %m", filename);
r = -errno;
goto error;
}
r = -errno;
goto error;
}
@@
-704,10
+695,8
@@
static int dump_core(sd_journal* j) {
}
r = save_core(j, output ? fileno(output) : STDOUT_FILENO, NULL, NULL);
}
r = save_core(j, output ? fileno(output) : STDOUT_FILENO, NULL, NULL);
- if (r < 0) {
- log_error_errno(r, "Coredump retrieval failed: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Coredump retrieval failed: %m");
r = sd_journal_previous(j);
if (r >= 0)
r = sd_journal_previous(j);
if (r >= 0)
@@
-735,10
+724,8
@@
static int run_gdb(sd_journal *j) {
fputs("\n", stdout);
r = sd_journal_get_data(j, "COREDUMP_EXE", (const void**) &data, &len);
fputs("\n", stdout);
r = sd_journal_get_data(j, "COREDUMP_EXE", (const void**) &data, &len);
- if (r < 0) {
- log_error_errno(r, "Failed to retrieve COREDUMP_EXE field: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to retrieve COREDUMP_EXE field: %m");
assert(len > strlen("COREDUMP_EXE="));
data += strlen("COREDUMP_EXE=");
assert(len > strlen("COREDUMP_EXE="));
data += strlen("COREDUMP_EXE=");
@@
-759,27
+746,25
@@
static int run_gdb(sd_journal *j) {
}
r = save_core(j, -1, &path, &unlink_path);
}
r = save_core(j, -1, &path, &unlink_path);
- if (r < 0) {
- log_error_errno(r, "Failed to retrieve core: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to retrieve core: %m");
pid = fork();
if (pid < 0) {
pid = fork();
if (pid < 0) {
- log_error
(
"Failed to fork(): %m");
+ log_error
_errno(errno,
"Failed to fork(): %m");
r = -errno;
goto finish;
}
if (pid == 0) {
execlp("gdb", "gdb", exe, path, NULL);
r = -errno;
goto finish;
}
if (pid == 0) {
execlp("gdb", "gdb", exe, path, NULL);
- log_error
(
"Failed to invoke gdb: %m");
+ log_error
_errno(errno,
"Failed to invoke gdb: %m");
_exit(1);
}
r = wait_for_terminate(pid, &st);
if (r < 0) {
_exit(1);
}
r = wait_for_terminate(pid, &st);
if (r < 0) {
- log_error
(
"Failed to wait for gdb: %m");
+ log_error
_errno(errno,
"Failed to wait for gdb: %m");
goto finish;
}
goto finish;
}