From 89c23755c8ab5d8c5bbbfa6e40eb0c6bda109dad Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Wed, 14 Jul 2021 14:39:31 +0300 Subject: update CVS --- usr.bin/patch/CVS/Entries | 28 ++++++++++++++-------------- usr.bin/patch/backupfile.c | 28 +++++++++++++++++++--------- 2 files changed, 33 insertions(+), 23 deletions(-) (limited to 'usr.bin/patch') diff --git a/usr.bin/patch/CVS/Entries b/usr.bin/patch/CVS/Entries index aab1841..123cecf 100644 --- a/usr.bin/patch/CVS/Entries +++ b/usr.bin/patch/CVS/Entries @@ -1,16 +1,16 @@ -/Makefile/1.5/Fri Oct 16 07:33:47 2015// -/backupfile.c/1.21/Tue Nov 26 13:19:07 2013// -/backupfile.h/1.6/Mon Jul 28 18:35:36 2003// -/common.h/1.30/Mon Dec 2 22:17:32 2019// -/ed.c/1.4/Mon Dec 2 22:17:32 2019// -/ed.h/1.1/Fri Oct 16 07:33:47 2015// -/inp.c/1.49/Fri Jun 28 13:35:02 2019// -/inp.h/1.8/Fri Aug 15 08:00:51 2003// -/mkpath.c/1.4/Tue May 20 01:25:23 2014// -/patch.1/1.32/Fri Jun 22 15:37:15 2018// /patch.c/1.69/Mon Dec 2 22:17:32 2019// -/pch.c/1.62/Mon Dec 2 22:23:19 2019// -/pch.h/1.13/Wed Dec 11 20:10:17 2019// -/util.c/1.45/Mon Dec 2 22:17:32 2019// -/util.h/1.18/Sat Aug 17 14:25:06 2019// +/Makefile/1.5/Mon Oct 19 10:36:43 2020// +/backupfile.c/1.22/Result of merge+Wed Jul 14 10:55:46 2021// +/backupfile.h/1.6/Mon Oct 19 10:36:43 2020// +/common.h/1.30/Mon Oct 19 10:36:43 2020// +/ed.c/1.4/Mon Oct 19 10:36:43 2020// +/ed.h/1.1/Mon Oct 19 10:36:43 2020// +/inp.c/1.49/Mon Oct 19 10:36:43 2020// +/inp.h/1.8/Mon Oct 19 10:36:43 2020// +/mkpath.c/1.4/Mon Oct 19 10:36:43 2020// +/patch.1/1.32/Mon Oct 19 10:36:43 2020// +/pch.c/1.62/Mon Oct 19 10:36:43 2020// +/pch.h/1.13/Mon Oct 19 10:36:43 2020// +/util.c/1.45/Mon Oct 19 10:36:43 2020// +/util.h/1.18/Mon Oct 19 10:36:43 2020// D diff --git a/usr.bin/patch/backupfile.c b/usr.bin/patch/backupfile.c index 243d00e..fc05e48 100644 --- a/usr.bin/patch/backupfile.c +++ b/usr.bin/patch/backupfile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: backupfile.c,v 1.21 2013/11/26 13:19:07 deraadt Exp $ */ +/* $OpenBSD: backupfile.c,v 1.22 2020/10/12 13:58:27 naddy Exp $ */ /* * backupfile.c -- make Emacs style backup file names Copyright (C) 1990 Free @@ -53,22 +53,32 @@ static void invalid_arg(const char *, const char *, int); char * find_backup_file_name(const char *file) { - char *path, *base_versions; + char *dir, *base_versions, *tmp_file; int highest_backup; if (backup_type == simple) return concat(file, simple_backup_suffix); - path = strdup(file); - if (path == NULL) + tmp_file = strdup(file); + if (tmp_file == NULL) return NULL; - base_versions = concat(basename(path), ".~"); - if (base_versions == NULL) { - free(path); + base_versions = concat(basename(tmp_file), ".~"); + free(tmp_file); + if (base_versions == NULL) + return NULL; + tmp_file = strdup(file); + if (tmp_file == NULL) { + free(base_versions); + return NULL; + } + dir = dirname(tmp_file); + if (dir == NULL) { + free(base_versions); + free(tmp_file); return NULL; } - highest_backup = max_backup_version(base_versions, dirname(path)); + highest_backup = max_backup_version(base_versions, dir); free(base_versions); - free(path); + free(tmp_file); if (backup_type == numbered_existing && highest_backup == 0) return concat(file, simple_backup_suffix); return make_version_name(file, highest_backup + 1); -- cgit v1.2.3