Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5ffb63f

Browse files
authoredMay 29, 2024··
Merge pull request #57 from fermitools/drop-more-returns
Not checking return code, so drop them
2 parents 8a60846 + 07f04db commit 5ffb63f

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed
 

‎src/C/kcron_seccomp.h

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -65,39 +65,39 @@ int set_kcron_seccomp(void) {
6565
/* Basic features */
6666
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(rt_sigreturn), 0) != 0) {
6767
(void)fprintf(stderr, "%s: Cannot set allowlist 'rt_sigreturn'.\n", __PROGRAM_NAME);
68-
seccomp_release(ctx);
68+
(void)seccomp_release(ctx);
6969
exit(EXIT_FAILURE);
7070
}
7171
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(brk), 0) != 0) {
7272
(void)fprintf(stderr, "%s: Cannot set allowlist 'brk'.\n", __PROGRAM_NAME);
73-
seccomp_release(ctx);
73+
(void)seccomp_release(ctx);
7474
exit(EXIT_FAILURE);
7575
}
7676
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(exit), 0) != 0) {
7777
(void)fprintf(stderr, "%s: Cannot set allowlist 'exit'.\n", __PROGRAM_NAME);
78-
seccomp_release(ctx);
78+
(void)seccomp_release(ctx);
7979
exit(EXIT_FAILURE);
8080
}
8181
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(exit_group), 0) != 0) {
8282
(void)fprintf(stderr, "%s: Cannot set allowlist 'exit_group'.\n", __PROGRAM_NAME);
83-
seccomp_release(ctx);
83+
(void)seccomp_release(ctx);
8484
exit(EXIT_FAILURE);
8585
}
8686

8787
/* Permitted actions */
8888
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(geteuid), 0) != 0) {
8989
(void)fprintf(stderr, "%s: Cannot set allowlist 'geteuid'.\n", __PROGRAM_NAME);
90-
seccomp_release(ctx);
90+
(void)seccomp_release(ctx);
9191
exit(EXIT_FAILURE);
9292
}
9393
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getuid), 0) != 0) {
9494
(void)fprintf(stderr, "%s: Cannot set allowlist 'getuid'.\n", __PROGRAM_NAME);
95-
seccomp_release(ctx);
95+
(void)seccomp_release(ctx);
9696
exit(EXIT_FAILURE);
9797
}
9898
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(getgid), 0) != 0) {
9999
(void)fprintf(stderr, "%s: Cannot set allowlist 'getgid'.\n", __PROGRAM_NAME);
100-
seccomp_release(ctx);
100+
(void)seccomp_release(ctx);
101101
exit(EXIT_FAILURE);
102102
}
103103

@@ -107,7 +107,7 @@ int set_kcron_seccomp(void) {
107107
*/
108108
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(write), 1, SCMP_A0(SCMP_CMP_EQ, 1)) != 0) {
109109
(void)fprintf(stderr, "%s: Cannot set allowlist 'write' to stdout.\n", __PROGRAM_NAME);
110-
seccomp_release(ctx);
110+
(void)seccomp_release(ctx);
111111
exit(EXIT_FAILURE);
112112
}
113113

@@ -116,7 +116,7 @@ int set_kcron_seccomp(void) {
116116
*/
117117
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(write), 1, SCMP_A0(SCMP_CMP_EQ, 2)) != 0) {
118118
(void)fprintf(stderr, "%s: Cannot set allowlist 'write' to stderr.\n", __PROGRAM_NAME);
119-
seccomp_release(ctx);
119+
(void)seccomp_release(ctx);
120120
exit(EXIT_FAILURE);
121121
}
122122

@@ -127,13 +127,13 @@ int set_kcron_seccomp(void) {
127127
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(openat), 0) != 0) {
128128
/* not sure how to restrict this to the args I want */
129129
(void)fprintf(stderr, "%s: Cannot set allowlist 'openat'.\n", __PROGRAM_NAME);
130-
seccomp_release(ctx);
130+
(void)seccomp_release(ctx);
131131
exit(EXIT_FAILURE);
132132
}
133133

134134
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(close), 1, SCMP_A0(SCMP_CMP_EQ, 3)) != 0) {
135135
(void)fprintf(stderr, "%s: Cannot set allowlist 'close'.\n", __PROGRAM_NAME);
136-
seccomp_release(ctx);
136+
(void)seccomp_release(ctx);
137137
exit(EXIT_FAILURE);
138138
}
139139

@@ -142,22 +142,22 @@ int set_kcron_seccomp(void) {
142142
*/
143143
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(write), 1, SCMP_A0(SCMP_CMP_EQ, 4)) != 0) {
144144
(void)fprintf(stderr, "%s: Cannot set allowlist 'write' to our file handle.\n", __PROGRAM_NAME);
145-
seccomp_release(ctx);
145+
(void)seccomp_release(ctx);
146146
exit(EXIT_FAILURE);
147147
}
148148
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(close), 1, SCMP_A0(SCMP_CMP_EQ, 4)) != 0) {
149149
(void)fprintf(stderr, "%s: Cannot set allowlist 'close'.\n", __PROGRAM_NAME);
150-
seccomp_release(ctx);
150+
(void)seccomp_release(ctx);
151151
exit(EXIT_FAILURE);
152152
}
153153
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(fsync), 1, SCMP_A0(SCMP_CMP_EQ, 4)) != 0) {
154154
(void)fprintf(stderr, "%s: Cannot set allowlist 'fsync' on file handle.\n", __PROGRAM_NAME);
155-
seccomp_release(ctx);
155+
(void)seccomp_release(ctx);
156156
exit(EXIT_FAILURE);
157157
}
158158
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(fchmod), 2, SCMP_A0(SCMP_CMP_EQ, 4), SCMP_A1(SCMP_CMP_EQ, _0600)) != 0) {
159159
(void)fprintf(stderr, "%s: Cannot set allowlist 'fchmod' for mode 0600 only.\n", __PROGRAM_NAME);
160-
seccomp_release(ctx);
160+
(void)seccomp_release(ctx);
161161
exit(EXIT_FAILURE);
162162
}
163163

@@ -166,49 +166,49 @@ int set_kcron_seccomp(void) {
166166
*/
167167
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(fstat), 0) != 0) {
168168
(void)fprintf(stderr, "%s: Cannot set allowlist 'fstat'.\n", __PROGRAM_NAME);
169-
seccomp_release(ctx);
169+
(void)seccomp_release(ctx);
170170
exit(EXIT_FAILURE);
171171
}
172172
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(stat), 0) != 0) {
173173
(void)fprintf(stderr, "%s: Cannot set allowlist 'stat'.\n", __PROGRAM_NAME);
174-
seccomp_release(ctx);
174+
(void)seccomp_release(ctx);
175175
exit(EXIT_FAILURE);
176176
}
177177
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(newfstatat), 0) != 0) {
178178
(void)fprintf(stderr, "%s: Cannot set allowlist 'newfstatat'.\n", __PROGRAM_NAME);
179-
seccomp_release(ctx);
179+
(void)seccomp_release(ctx);
180180
exit(EXIT_FAILURE);
181181
}
182182
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(mkdir), 0) != 0) {
183183
(void)fprintf(stderr, "%s: Cannot set allowlist 'mkdir'.\n", __PROGRAM_NAME);
184-
seccomp_release(ctx);
184+
(void)seccomp_release(ctx);
185185
exit(EXIT_FAILURE);
186186
}
187187
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(fchown), 0) != 0) {
188188
(void)fprintf(stderr, "%s: Cannot set allowlist 'fchown'.\n", __PROGRAM_NAME);
189-
seccomp_release(ctx);
189+
(void)seccomp_release(ctx);
190190
exit(EXIT_FAILURE);
191191
}
192192

193193

194194
#if USE_CAPABILITIES == 1
195195
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(capget), 0) != 0) {
196196
(void)fprintf(stderr, "%s: Cannot set allowlist 'capget'.\n", __PROGRAM_NAME);
197-
seccomp_release(ctx);
197+
(void)seccomp_release(ctx);
198198
exit(EXIT_FAILURE);
199199
}
200200
if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(capset), 0) != 0) {
201201
(void)fprintf(stderr, "%s: Cannot set allowlist 'capset'.\n", __PROGRAM_NAME);
202-
seccomp_release(ctx);
202+
(void)seccomp_release(ctx);
203203
exit(EXIT_FAILURE);
204204
}
205205
#endif
206206

207207
/* Load rules */
208-
seccomp_load(ctx);
208+
(void)seccomp_load(ctx);
209209

210210
/* Release memory */
211-
seccomp_release(ctx);
211+
(void)seccomp_release(ctx);
212212

213213
return 0;
214214
}

0 commit comments

Comments
 (0)
Please sign in to comment.