| 261 | DEFINE_LINKED_LIST (SeccompProgram, seccomp_program) |
| 262 | |
| 263 | static SeccompProgram * |
| 264 | seccomp_program_new (int *fd) |
| 265 | { |
| 266 | SeccompProgram *self = _seccomp_program_append_new (); |
| 267 | cleanup_free char *data = NULL; |
| 268 | size_t len; |
| 269 | |
| 270 | data = load_file_data (*fd, &len); |
| 271 | |
| 272 | if (data == NULL) |
| 273 | die_with_error ("Can't read seccomp data"); |
| 274 | |
| 275 | close (*fd); |
| 276 | *fd = -1; |
| 277 | |
| 278 | if (len % 8 != 0) |
| 279 | die ("Invalid seccomp data, must be multiple of 8"); |
| 280 | |
| 281 | self->program.len = len / 8; |
| 282 | self->program.filter = (struct sock_filter *) steal_pointer (&data); |
| 283 | return self; |
| 284 | } |
| 285 | |
| 286 | static void |
| 287 | seccomp_programs_apply (void) |
no test coverage detected