summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-05-30 18:03:02 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-05-30 18:03:02 +0000
commite8974de17ca54835c83e6c68c9c8697ea33d0df0 (patch)
treee85051333f43e4ca2953aaced06e9bd11a9e923e
parent4db2447ff74d0049a945ed227d01d89506346dc8 (diff)
Handle process_load() failure. This prevents "pmdb foo" to dump core upon
run command, if foo does not exist. ok art@
-rw-r--r--usr.bin/pmdb/process.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/pmdb/process.c b/usr.bin/pmdb/process.c
index 8e9ce59e16e..ccbfe11a718 100644
--- a/usr.bin/pmdb/process.c
+++ b/usr.bin/pmdb/process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.c,v 1.10 2002/08/08 18:27:57 art Exp $ */
+/* $OpenBSD: process.c,v 1.11 2003/05/30 18:03:01 miod Exp $ */
/*
* Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -53,7 +53,7 @@ process_load(struct pstate *ps)
if (access(*ps->ps_argv, R_OK|X_OK) < 0) {
fprintf(stderr, "%s: %s.\n", *ps->ps_argv,
strerror(errno));
- return (0);
+ return (1);
}
if (stat(ps->ps_argv[0], &(ps->exec_stat)) < 0)
@@ -200,7 +200,9 @@ cmd_process_run(int argc, char **argv, void *arg)
if (ps->ps_state == NONE) {
reg main_addr;
- process_load(ps);
+ if (process_load(ps) != 0)
+ return (0);
+
if (sym_lookup(ps, "main", &main_addr))
warnx("no main");
else if (bkpt_add_cb(ps, main_addr, process_bkpt_main, NULL))