remove redundant else and fix formatting

This commit is contained in:
xfnw 2024-01-08 13:12:42 -05:00
parent c6ed6a3b25
commit 743cac974d
1 changed files with 11 additions and 13 deletions

View File

@ -22,8 +22,8 @@
#include <sys/prctl.h>
#include <sys/syscall.h>
#define ALLOW(syscall) \
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, SYS_##syscall, 0, 1), \
#define ALLOW(syscall) \
BPF_JUMP(BPF_JMP + BPF_JEQ + BPF_K, SYS_##syscall, 0, 1), \
BPF_STMT(BPF_RET + BPF_K, SECCOMP_RET_ALLOW)
static int setup_seccomp() {
@ -113,18 +113,16 @@ void *handle_connection(void *socket_desc) {
if (read_size == 36) {
/* line too long, attempt parsing anyways */
read_to = (uintptr_t)client_message + read_size;
} else {
/* line partially read, try reading more */
read_size = recv(sock, client_message, 36,
MSG_PEEK
#ifndef LOSSY
| MSG_WAITALL
#endif
);
client_message[read_size] = '\0';
read_to =
(uintptr_t)strchrnul(client_message, '\n');
}
/* line partially read, try reading more */
read_size = recv(sock, client_message, 36,
MSG_PEEK
#ifndef LOSSY
| MSG_WAITALL
#endif
);
client_message[read_size] = '\0';
read_to = (uintptr_t)strchrnul(client_message, '\n');
}
read_to = read_to - (uintptr_t)client_message;
read_size = recv(sock, client_message, read_to + 1, 0);