aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2020-05-30 12:57:15 +0200
committerMattias Andrée <maandree@kth.se>2020-05-30 12:57:15 +0200
commit557784751f11b790258068fcba6c277bf5a7ee58 (patch)
treef271dfb161d21b05cd83e8474188381876b64ead
parentUse process_vm_readv instead of PTRACE_PEEKDATA (no fallback) (diff)
downloadsctrace-557784751f11b790258068fcba6c277bf5a7ee58.tar.gz
sctrace-557784751f11b790258068fcba6c277bf5a7ee58.tar.bz2
sctrace-557784751f11b790258068fcba6c277bf5a7ee58.tar.xz
Minor simplification
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--sctrace.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sctrace.c b/sctrace.c
index 8be566f..3a29e2e 100644
--- a/sctrace.c
+++ b/sctrace.c
@@ -63,7 +63,7 @@ get_string(pid_t pid, unsigned long int addr, size_t *lenp, const char **errorp)
struct iovec inv, outv;
size_t off = 0, size = 0, page_off, read_size;
char *out = NULL, *in = (char *)addr, *p;
- page_off = (size_t)addr - ((size_t)addr & -sizeof(PAGE_SIZE));
+ page_off = (size_t)addr % sizeof(PAGE_SIZE);
read_size = PAGE_SIZE - page_off;
*errorp = NULL;
for (;; read_size = PAGE_SIZE) {