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");
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to