summaryrefslogtreecommitdiff
path: root/sys-apps/systemd/files/243-rc1-analyze.patch
blob: e38b51eb1210f2436cacf1cfda9414e67557f40a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
From 417b82e1c341946d277383471f2972b7227061ff Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Tue, 30 Jul 2019 14:51:38 -0400
Subject: [PATCH] analyze: declare dump_exit_status outside of HAVE_SECCOMP
 block

Fixes: 76ed04d936f757763c32db5dbaaebd8b13785d7b
Closes: https://github.com/systemd/systemd/issues/13230
---
 src/analyze/analyze.c | 92 +++++++++++++++++++++----------------------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index f62879371d..4d81026084 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -1608,6 +1608,52 @@ static int dump_unit_paths(int argc, char *argv[], void *userdata) {
         return 0;
 }
 
+static int dump_exit_status(int argc, char *argv[], void *userdata) {
+        _cleanup_(table_unrefp) Table *table = NULL;
+        int r;
+
+        table = table_new("name", "status", "class");
+        if (!table)
+                return log_oom();
+
+        r = table_set_align_percent(table, table_get_cell(table, 0, 1), 100);
+        if (r < 0)
+                return log_error_errno(r, "Failed to right-align status: %m");
+
+        if (strv_isempty(strv_skip(argv, 1)))
+                for (size_t i = 0; i < ELEMENTSOF(exit_status_mappings); i++) {
+                        if (!exit_status_mappings[i].name)
+                                continue;
+
+                        r = table_add_many(table,
+                                           TABLE_STRING, exit_status_mappings[i].name,
+                                           TABLE_INT, (int) i,
+                                           TABLE_STRING, exit_status_class(i));
+                        if (r < 0)
+                                return r;
+                }
+        else
+                for (int i = 1; i < argc; i++) {
+                        int status;
+
+                        status = exit_status_from_string(argv[i]);
+                        if (status < 0)
+                                return log_error_errno(r, "Invalid exit status \"%s\": %m", argv[i]);
+
+                        assert(status >= 0 && (size_t) status < ELEMENTSOF(exit_status_mappings));
+                        r = table_add_many(table,
+                                           TABLE_STRING, exit_status_mappings[status].name ?: "-",
+                                           TABLE_INT, status,
+                                           TABLE_STRING, exit_status_class(status) ?: "-");
+                        if (r < 0)
+                                return r;
+                }
+
+        (void) pager_open(arg_pager_flags);
+
+        return table_print(table, NULL);
+}
+
 #if HAVE_SECCOMP
 
 static int load_kernel_syscalls(Set **ret) {
@@ -1685,52 +1731,6 @@ static void dump_syscall_filter(const SyscallFilterSet *set) {
                 printf("    %s%s%s\n", syscall[0] == '@' ? ansi_underline() : "", syscall, ansi_normal());
 }
 
-static int dump_exit_status(int argc, char *argv[], void *userdata) {
-        _cleanup_(table_unrefp) Table *table = NULL;
-        int r;
-
-        table = table_new("name", "status", "class");
-        if (!table)
-                return log_oom();
-
-        r = table_set_align_percent(table, table_get_cell(table, 0, 1), 100);
-        if (r < 0)
-                return log_error_errno(r, "Failed to right-align status: %m");
-
-        if (strv_isempty(strv_skip(argv, 1)))
-                for (size_t i = 0; i < ELEMENTSOF(exit_status_mappings); i++) {
-                        if (!exit_status_mappings[i].name)
-                                continue;
-
-                        r = table_add_many(table,
-                                           TABLE_STRING, exit_status_mappings[i].name,
-                                           TABLE_INT, (int) i,
-                                           TABLE_STRING, exit_status_class(i));
-                        if (r < 0)
-                                return r;
-                }
-        else
-                for (int i = 1; i < argc; i++) {
-                        int status;
-
-                        status = exit_status_from_string(argv[i]);
-                        if (status < 0)
-                                return log_error_errno(r, "Invalid exit status \"%s\": %m", argv[i]);
-
-                        assert(status >= 0 && (size_t) status < ELEMENTSOF(exit_status_mappings));
-                        r = table_add_many(table,
-                                           TABLE_STRING, exit_status_mappings[status].name ?: "-",
-                                           TABLE_INT, status,
-                                           TABLE_STRING, exit_status_class(status) ?: "-");
-                        if (r < 0)
-                                return r;
-                }
-
-        (void) pager_open(arg_pager_flags);
-
-        return table_print(table, NULL);
-}
-
 static int dump_syscall_filters(int argc, char *argv[], void *userdata) {
         bool first = true;
 
-- 
2.22.0