about summary refs log tree commit diff
path: root/frida_mode/src/seccomp/seccomp_print.c
blob: 3cea12399b2381140dffaae348151a3819567ac0 (plain) (blame)
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
#if defined(__linux__) && !defined(__ANDROID__)

  #include <stdarg.h>

  #include "seccomp.h"
  #include "util.h"

static void seccomp_print_v(int fd, char *format, va_list ap) {

  char buffer[4096] = {0};
  int  len;

  if (vsnprintf(buffer, sizeof(buffer) - 1, format, ap) < 0) { return; }

  len = strnlen(buffer, sizeof(buffer));
  IGNORED_RETURN(write(fd, buffer, len));

}

void seccomp_print(char *format, ...) {

  va_list ap;
  va_start(ap, format);
  seccomp_print_v(SECCOMP_OUTPUT_FILE_FD, format, ap);
  va_end(ap);

}

#endif