Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jun 2017 21:48:33 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r320086 - stable/10/usr.bin/patch
Message-ID:  <201706182148.v5ILmXJ5065864@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Sun Jun 18 21:48:33 2017
New Revision: 320086
URL: https://svnweb.freebsd.org/changeset/base/320086

Log:
  MFC r319676:
  patch: if reading fails, do not go into infinite loop asking for a filename.
  
  This can happen if no tty is available.
  
  Obtained from:	OpenBSD (CVS rev 1.54)

Modified:
  stable/10/usr.bin/patch/pch.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/patch/pch.c
==============================================================================
--- stable/10/usr.bin/patch/pch.c	Sun Jun 18 21:48:31 2017	(r320085)
+++ stable/10/usr.bin/patch/pch.c	Sun Jun 18 21:48:33 2017	(r320086)
@@ -216,8 +216,10 @@ there_is_another_patch(void)
 			filearg[0] = fetchname(buf, &exists, 0);
 		}
 		if (!exists) {
-			ask("No file found--skip this patch? [n] ");
-			if (*buf != 'y')
+			int def_skip = *bestguess == '\0';
+			ask("No file found--skip this patch? [%c] ",
+			    def_skip  ? 'y' : 'n');
+			if (*buf == 'n' || (!def_skip && *buf != 'y'))
 				continue;
 			if (verbose)
 				say("Skipping patch...\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706182148.v5ILmXJ5065864>