summaryrefslogtreecommitdiff
path: root/usr.bin/pmdb
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2003-08-02 20:38:39 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2003-08-02 20:38:39 +0000
commitf4b1dfafe5f5bd94a10bf7dd529b90892fc4e198 (patch)
tree8f40135a8755dc602d0f2369e0d5cf84c4248cf6 /usr.bin/pmdb
parent89dd1a7aeacf472d2b7eb4de61e7fb43cd548e2b (diff)
check return value from process_{read,write} proper
Diffstat (limited to 'usr.bin/pmdb')
-rw-r--r--usr.bin/pmdb/break.c8
-rw-r--r--usr.bin/pmdb/pmdb.c4
-rw-r--r--usr.bin/pmdb/process.c8
3 files changed, 11 insertions, 9 deletions
diff --git a/usr.bin/pmdb/break.c b/usr.bin/pmdb/break.c
index da5e3150f0d..18e708baf97 100644
--- a/usr.bin/pmdb/break.c
+++ b/usr.bin/pmdb/break.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: break.c,v 1.7 2002/11/27 22:36:24 pvalchev Exp $ */
+/* $OpenBSD: break.c,v 1.8 2003/08/02 20:38:38 mickey Exp $ */
/*
* Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -79,13 +79,13 @@ bkpt_enable(struct pstate *ps, struct breakpoint *bkpt)
{
reg pc = bkpt->bkpt_pc;
- if (process_read(ps, pc, &bkpt->bkpt_old, BREAKPOINT_LEN)) {
+ if (process_read(ps, pc, &bkpt->bkpt_old, BREAKPOINT_LEN) < 0) {
warn("Can't read process contents at 0x%lx", pc);
return (-1);
}
- if (process_write(ps, pc, &bkpt_insn, BREAKPOINT_LEN)) {
+ if (process_write(ps, pc, &bkpt_insn, BREAKPOINT_LEN) < 0) {
warn("Can't write breakpoint at 0x%lx, attempting backout.", pc);
- if (process_write(ps, pc, &bkpt->bkpt_old, BREAKPOINT_LEN))
+ if (process_write(ps, pc, &bkpt->bkpt_old, BREAKPOINT_LEN) < 0)
warn("Backout failed, process unstable");
return (-1);
}
diff --git a/usr.bin/pmdb/pmdb.c b/usr.bin/pmdb/pmdb.c
index 3a4edf151fb..972c4028496 100644
--- a/usr.bin/pmdb/pmdb.c
+++ b/usr.bin/pmdb/pmdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmdb.c,v 1.17 2003/06/10 22:20:49 deraadt Exp $ */
+/* $OpenBSD: pmdb.c,v 1.18 2003/08/02 20:38:38 mickey Exp $ */
/*
* Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -327,7 +327,7 @@ cmd_examine(int argc, char **argv, void *arg)
}
}
- if (process_read(ps, addr, &val, sizeof(val))) {
+ if (process_read(ps, addr, &val, sizeof(val)) < 0) {
warn("Can't read process contents at 0x%lx", addr);
return (0);
}
diff --git a/usr.bin/pmdb/process.c b/usr.bin/pmdb/process.c
index ccbfe11a718..a1b40f6ef22 100644
--- a/usr.bin/pmdb/process.c
+++ b/usr.bin/pmdb/process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.c,v 1.11 2003/05/30 18:03:01 miod Exp $ */
+/* $OpenBSD: process.c,v 1.12 2003/08/02 20:38:38 mickey Exp $ */
/*
* Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -140,7 +140,8 @@ process_read(struct pstate *ps, off_t from, void *to, size_t size)
piod.piod_addr = to;
piod.piod_len = size;
- return (ptrace(PT_IO, ps->ps_pid, (caddr_t)&piod, 0));
+ return (ptrace(PT_IO, ps->ps_pid, (caddr_t)&piod, 0) < 0?
+ -1 : piod.piod_len);
}
}
@@ -157,7 +158,8 @@ process_write(struct pstate *ps, off_t to, void *from, size_t size)
piod.piod_addr = from;
piod.piod_len = size;
- return (ptrace(PT_IO, ps->ps_pid, (caddr_t)&piod, 0));
+ return (ptrace(PT_IO, ps->ps_pid, (caddr_t)&piod, 0) < 0?
+ -1 : piod.piod_len);
}
}