|
Lines 65-79
static void writeUnsignedInt(char* buf, unsigned val)
a/Source/WebKit2/Shared/linux/SeccompFilters/Syscall.cpp_sec1
|
| 65 |
static void reportUnexpectedSyscall(unsigned syscall) |
65 |
static void reportUnexpectedSyscall(unsigned syscall) |
| 66 |
{ |
66 |
{ |
| 67 |
char buf[128]; |
67 |
char buf[128]; |
| 68 |
#if defined(__has_builtin) && __has_builtin(__builtin_strlen) |
68 |
#if defined(__has_builtin) |
|
|
69 |
#if __has_builtin(__builtin_strlen) |
| 69 |
// Buffer must be big enough for the literal, plus the number of digits in the largest possible |
70 |
// Buffer must be big enough for the literal, plus the number of digits in the largest possible |
| 70 |
// unsigned int, plus one for the newline, plus one more for the trailing null. |
71 |
// unsigned int, plus one for the newline, plus one more for the trailing null. |
| 71 |
static_assert(__builtin_strlen(message) + std::numeric_limits<unsigned>::digits10 + 2 < sizeof(buf), "Buffer too small"); |
72 |
static_assert(__builtin_strlen(message) + std::numeric_limits<unsigned>::digits10 + 2 < sizeof(buf), "Buffer too small"); |
| 72 |
#endif |
73 |
#endif |
|
|
74 |
#endif |
| 73 |
strcpy(buf, message); |
75 |
strcpy(buf, message); |
| 74 |
writeUnsignedInt(buf + strlen(buf), syscall); |
76 |
writeUnsignedInt(buf + strlen(buf), syscall); |
| 75 |
strcat(buf, "\n"); |
77 |
strcat(buf, "\n"); |
| 76 |
write(STDERR_FILENO, buf, strlen(buf)); |
78 |
int unused __attribute__((unused)); |
|
|
79 |
unused = write(STDERR_FILENO, buf, strlen(buf)); |
| 77 |
} |
80 |
} |
| 78 |
|
81 |
|
| 79 |
std::unique_ptr<Syscall> Syscall::createFromContext(ucontext_t* ucontext) |
82 |
std::unique_ptr<Syscall> Syscall::createFromContext(ucontext_t* ucontext) |