From 30057f9126e97dabcbf6fbda2fda183a132c35b6 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Wed, 28 Jan 2004 08:31:08 +0000 Subject: Fix a segv when patch cannot find a file and the user indicates to use the file anyway. Problem found by david@ ok david@ millert@ --- usr.bin/patch/pch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index 7227d466499..55c6e725a47 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pch.c,v 1.32 2003/10/31 20:20:45 millert Exp $ */ +/* $OpenBSD: pch.c,v 1.33 2004/01/28 08:31:07 otto Exp $ */ /* * patch - a program to apply diffs to original files @@ -27,7 +27,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: pch.c,v 1.32 2003/10/31 20:20:45 millert Exp $"; +static const char rcsid[] = "$OpenBSD: pch.c,v 1.33 2004/01/28 08:31:07 otto Exp $"; #endif /* not lint */ #include @@ -228,12 +228,12 @@ there_is_another_patch(void) filearg[0] = fetchname(buf, &exists, 0); } if (!exists) { - free(filearg[0]); ask("No file found--skip this patch? [n] "); if (*buf != 'y') continue; if (verbose) say("Skipping patch...\n"); + free(filearg[0]); filearg[0] = fetchname(bestguess, &exists, 0); skip_rest_of_patch = true; return true; -- cgit v1.2.3