Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Jun 2017 21:46:54 +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-11@freebsd.org
Subject:   svn commit: r320084 - stable/11/usr.bin/patch
Message-ID:  <201706182146.v5ILks7Z065710@repo.freebsd.org>

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

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)
  Approved by:	re (marius)

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

Modified: stable/11/usr.bin/patch/pch.c
==============================================================================
--- stable/11/usr.bin/patch/pch.c	Sun Jun 18 21:03:53 2017	(r320083)
+++ stable/11/usr.bin/patch/pch.c	Sun Jun 18 21:46:54 2017	(r320084)
@@ -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?201706182146.v5ILks7Z065710>