lobase

Linux port of OpenBSDs userland.
Log | Files | Refs | README

commit e0b67ceff81c11b027a59db257005ccf25d5b010
parent fe3d19bcc46016129cae9ae84d8df815286c2021
Author: Duncaen <mail@duncano.de>
Date:   Fri, 19 May 2017 18:46:56 +0200

usr.bin/patch: update to OPENBSD_6_1

Diffstat:
usr.bin/patch/ed.c | 5+++--
usr.bin/patch/inp.c | 11+++++------
usr.bin/patch/pch.c | 10++++++----
3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/usr.bin/patch/ed.c b/usr.bin/patch/ed.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ed.c,v 1.2 2016/02/22 19:31:38 tobias Exp $ */ +/* $OpenBSD: ed.c,v 1.3 2016/09/02 21:39:51 tobias Exp $ */ /* * Copyright (c) 2015 Tobias Stoeckmann <tobias@openbsd.org> @@ -103,7 +103,8 @@ do_ed_script(void) cline = nline; line_count--; } - fsm = (fsm == FSM_C) ? FSM_I : FSM_CMD; + cline = get_line(first_addr - 1); + fsm = (fsm == FSM_C) ? FSM_A : FSM_CMD; break; case FSM_S: cline->subst++; diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inp.c,v 1.46 2016/07/19 06:43:27 deraadt Exp $ */ +/* $OpenBSD: inp.c,v 1.47 2017/03/25 23:13:45 deraadt Exp $ */ /* * patch - a program to apply diffs to original files @@ -32,7 +32,6 @@ #include <sys/mman.h> #include <ctype.h> -#include <fcntl.h> #include <libgen.h> #include <stddef.h> #include <stdint.h> @@ -107,22 +106,22 @@ scan_input(const char *filename) } static bool -reallocate_lines(size_t *lines_allocated) +reallocate_lines(size_t *lines_allocatedp) { char **p; size_t new_size; - new_size = *lines_allocated * 3 / 2; + new_size = *lines_allocatedp * 3 / 2; p = reallocarray(i_ptr, new_size + 2, sizeof(char *)); if (p == NULL) { /* shucks, it was a near thing */ munmap(i_womp, i_size); i_womp = NULL; free(i_ptr); i_ptr = NULL; - *lines_allocated = 0; + *lines_allocatedp = 0; return false; } - *lines_allocated = new_size; + *lines_allocatedp = new_size; i_ptr = p; return true; } diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pch.c,v 1.54 2015/10/16 07:33:47 tobias Exp $ */ +/* $OpenBSD: pch.c,v 1.56 2017/03/26 15:28:12 deraadt Exp $ */ /* * patch - a program to apply diffs to original files @@ -157,7 +157,7 @@ grow_hunkmax(void) if (new_p_len == NULL) free(p_len); - new_p_char = reallocarray(p_char, new_hunkmax, sizeof(char)); + new_p_char = recallocarray(p_char, hunkmax, new_hunkmax, sizeof(char)); if (new_p_char == NULL) free(p_char); @@ -225,8 +225,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");