=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/util.c,v retrieving revision 1.43 retrieving revision 1.44 diff -c -r1.43 -r1.44 *** src/usr.bin/patch/util.c 2019/06/28 13:35:02 1.43 --- src/usr.bin/patch/util.c 2019/08/17 14:25:06 1.44 *************** *** 1,4 **** ! /* $OpenBSD: util.c,v 1.43 2019/06/28 13:35:02 deraadt Exp $ */ /* * patch - a program to apply diffs to original files --- 1,4 ---- ! /* $OpenBSD: util.c,v 1.44 2019/08/17 14:25:06 deraadt Exp $ */ /* * patch - a program to apply diffs to original files *************** *** 289,298 **** if (!reset) { hupval = signal(SIGHUP, SIG_IGN); if (hupval != SIG_IGN) ! hupval = (sig_t) my_exit; intval = signal(SIGINT, SIG_IGN); if (intval != SIG_IGN) ! intval = (sig_t) my_exit; } signal(SIGHUP, hupval); signal(SIGINT, intval); --- 289,298 ---- if (!reset) { hupval = signal(SIGHUP, SIG_IGN); if (hupval != SIG_IGN) ! hupval = my_sigexit; intval = signal(SIGINT, SIG_IGN); if (intval != SIG_IGN) ! intval = my_sigexit; } signal(SIGHUP, hupval); signal(SIGINT, intval); *************** *** 393,403 **** my_exit(EXIT_SUCCESS); } - /* - * Exit with cleanup. - */ void ! my_exit(int status) { unlink(TMPINNAME); if (!toutkeep) --- 393,400 ---- my_exit(EXIT_SUCCESS); } void ! my_cleanup(void) { unlink(TMPINNAME); if (!toutkeep) *************** *** 405,409 **** --- 402,425 ---- if (!trejkeep) unlink(TMPREJNAME); unlink(TMPPATNAME); + } + + /* + * Exit with cleanup. + */ + void + my_exit(int status) + { + my_cleanup(); exit(status); + } + + /* + * Exit with cleanup, from a signal handler. + */ + void + my_sigexit(int signo) + { + my_cleanup(); + _exit(2); }