From 7c9c5302fbd170b2f1cf9fa31f49f246ff4bd049 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 13 Jan 2005 23:17:17 +0000 Subject: [PATCH] Do not early terminate if ^C is hit just as a valid job is returned by wait*(), otherwise the job termination will not be properly recorded. --- bin/sh/jobs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index 52fc842d9a..26476bf366 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -35,7 +35,7 @@ * * @(#)jobs.c 8.5 (Berkeley) 5/4/95 * $FreeBSD: src/bin/sh/jobs.c,v 1.27.2.10 2003/04/04 08:16:26 tjr Exp $ - * $DragonFly: src/bin/sh/jobs.c,v 1.5 2004/03/19 18:39:41 cpressey Exp $ + * $DragonFly: src/bin/sh/jobs.c,v 1.6 2005/01/13 23:17:17 dillon Exp $ */ #include @@ -926,7 +926,12 @@ dowait(int block, struct job *job) in_dowait--; if (breakwaitcmd != 0) { breakwaitcmd = 0; - return -1; + /* + * Do not early terminate if the pid is positive, else the + * job will not be properly recorded. + */ + if (pid <= 0) + return -1; } if (pid <= 0) return pid; -- 2.41.0