Date: Thu, 8 Jun 2017 03:15:08 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319676 - head/usr.bin/patch Message-ID: <201706080315.v583F8oQ047514@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Thu Jun 8 03:15:08 2017 New Revision: 319676 URL: https://svnweb.freebsd.org/changeset/base/319676 Log: 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) MFC after: 5 days Modified: head/usr.bin/patch/pch.c Modified: head/usr.bin/patch/pch.c ============================================================================== --- head/usr.bin/patch/pch.c Thu Jun 8 02:44:34 2017 (r319675) +++ head/usr.bin/patch/pch.c Thu Jun 8 03:15:08 2017 (r319676) @@ -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?201706080315.v583F8oQ047514>