Commit d38dbc7e authored by Gabor Buella's avatar Gabor Buella

apply correct casts in syscall_no_intercept calls

parent 57660394
......@@ -45,7 +45,7 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
long log_fd;
int log_fd;
static char buffer[0x20000];
static size_t buffer_offset;
......@@ -849,7 +849,8 @@ start(void)
if (path == NULL)
syscall_no_intercept(SYS_exit_group, 3);
log_fd = syscall_no_intercept(SYS_open, path, O_CREAT | O_RDWR, 0700);
log_fd = (int)syscall_no_intercept(SYS_open,
path, O_CREAT | O_RDWR, (mode_t)0700);
if (log_fd < 0)
syscall_no_intercept(SYS_exit_group, 4);
......
......@@ -66,7 +66,7 @@ entry_point(void)
* chars at a time. See syscall_hook_in_process_allowed below.
*/
static bool
match_with_file_end(const char *expected, long fd)
match_with_file_end(const char *expected, int fd)
{
char file_c; /* next character from file */
const char *c; /* next character from the expected string */
......@@ -76,7 +76,8 @@ match_with_file_end(const char *expected, long fd)
c = expected;
while (syscall_no_intercept(SYS_read, fd, &file_c, 1) == 1) {
while (syscall_no_intercept(SYS_read, fd, &file_c, (size_t)1)
== (ssize_t)1) {
if (file_c == '\0') /* this probably never happens */
break;
......@@ -98,7 +99,7 @@ match_with_file_end(const char *expected, long fd)
int
syscall_hook_in_process_allowed(void)
{
long fd;
int fd;
bool result;
const char *filter;
......@@ -106,7 +107,8 @@ syscall_hook_in_process_allowed(void)
if (filter == NULL)
return 1;
fd = syscall_no_intercept(SYS_open, "/proc/self/cmdline", O_RDONLY, 0);
fd = (int)syscall_no_intercept(SYS_open,
"/proc/self/cmdline", O_RDONLY, (mode_t)0);
if (fd < 0)
return 0;
......
......@@ -57,10 +57,10 @@
* only be present in the original file.
* Note on naming: memory has segments, the object file has sections.
*/
static long
static int
open_orig_file(const struct intercept_desc *desc)
{
long fd;
int fd;
fd = syscall_no_intercept(SYS_open, desc->path, O_RDONLY);
......@@ -106,7 +106,7 @@ add_text_info(struct intercept_desc *desc, const Elf64_Shdr *header,
* See: man elf
*/
static void
find_sections(struct intercept_desc *desc, long fd)
find_sections(struct intercept_desc *desc, int fd)
{
Elf64_Ehdr elf_header;
......@@ -293,7 +293,7 @@ mark_jump(const struct intercept_desc *desc, const unsigned char *addr)
*/
static void
find_jumps_in_section_syms(struct intercept_desc *desc, Elf64_Shdr *section,
long fd)
int fd)
{
assert(section->sh_type == SHT_SYMTAB ||
section->sh_type == SHT_DYNSYM);
......@@ -344,7 +344,7 @@ find_jumps_in_section_syms(struct intercept_desc *desc, Elf64_Shdr *section,
*/
static void
find_jumps_in_section_rela(struct intercept_desc *desc, Elf64_Shdr *section,
long fd)
int fd)
{
assert(section->sh_type == SHT_RELA);
......@@ -691,7 +691,7 @@ find_syscalls(struct intercept_desc *desc)
desc->count = 0;
long fd = open_orig_file(desc);
int fd = open_orig_file(desc);
find_sections(desc, fd);
debug_dump(
......
......@@ -48,7 +48,7 @@
#include <sched.h>
#include <linux/limits.h>
static long log_fd = -1;
static int log_fd = -1;
void *
xmmap_anon(size_t size)
......@@ -56,7 +56,7 @@ xmmap_anon(size_t size)
void *addr = (void *) syscall_no_intercept(SYS_mmap,
NULL, size,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON, -1, 0);
MAP_PRIVATE | MAP_ANON, -1, (off_t)0);
if (addr == MAP_FAILED)
xabort("xmmap_anon");
......@@ -98,7 +98,7 @@ void
xread(long fd, void *buffer, size_t size)
{
if (syscall_no_intercept(SYS_read, fd,
(long)buffer, (long)size) != (long)size)
buffer, size) != (ssize_t)size)
xabort("xread");
}
......@@ -130,7 +130,7 @@ intercept_setup_log(const char *path_base, const char *trunc)
intercept_log_close();
log_fd = syscall_no_intercept(SYS_open, path, flags, 0700);
log_fd = (int)syscall_no_intercept(SYS_open, path, flags, (mode_t)0700);
if (log_fd < 0)
xabort("setup_log");
......@@ -1520,7 +1520,7 @@ intercept_log(const char *buffer, size_t len)
{
if (log_fd >= 0)
syscall_no_intercept(SYS_write, log_fd,
(long)buffer, (long)len);
buffer, len);
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment