aboutsummaryrefslogtreecommitdiff
path: root/patches/0010-patch-Fix-with-musl-s-basename-dirname.patch
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-10-16 17:41:25 +0300
committerCem Keylan <cem@ckyln.com>2020-10-16 17:41:25 +0300
commite2abcdca396661cbe0ae2ddb13d5c2b85682c13a (patch)
treeacf9b5c80b645617f882c45224c6e07251711842 /patches/0010-patch-Fix-with-musl-s-basename-dirname.patch
downloadotools-e2abcdca396661cbe0ae2ddb13d5c2b85682c13a.tar.gz
initial commit
Diffstat (limited to 'patches/0010-patch-Fix-with-musl-s-basename-dirname.patch')
-rw-r--r--patches/0010-patch-Fix-with-musl-s-basename-dirname.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/patches/0010-patch-Fix-with-musl-s-basename-dirname.patch b/patches/0010-patch-Fix-with-musl-s-basename-dirname.patch
new file mode 100644
index 0000000..80a1db3
--- /dev/null
+++ b/patches/0010-patch-Fix-with-musl-s-basename-dirname.patch
@@ -0,0 +1,46 @@
+From e16acc0e80f475b2139eabe1b07b7eb0521a7918 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Sat, 4 Jun 2016 20:13:35 -0700
+Subject: [PATCH] patch: Fix with musl's basename/dirname
+
+---
+ usr.bin/patch/backupfile.c | 15 ++++++++-------
+ 1 file changed, 8 insertions(+), 7 deletions(-)
+
+diff --git a/usr.bin/patch/backupfile.c b/usr.bin/patch/backupfile.c
+index 1d7858ae3..243d00e32 100644
+--- a/usr.bin/patch/backupfile.c
++++ b/usr.bin/patch/backupfile.c
+@@ -53,21 +53,22 @@ static void invalid_arg(const char *, const char *, int);
+ char *
+ find_backup_file_name(const char *file)
+ {
+- char *dir, *base_versions;
++ char *path, *base_versions;
+ int highest_backup;
+
+ if (backup_type == simple)
+ return concat(file, simple_backup_suffix);
+- base_versions = concat(basename(file), ".~");
+- if (base_versions == NULL)
++ path = strdup(file);
++ if (path == NULL)
+ return NULL;
+- dir = dirname(file);
+- if (dir == NULL) {
+- free(base_versions);
++ base_versions = concat(basename(path), ".~");
++ if (base_versions == NULL) {
++ free(path);
+ return NULL;
+ }
+- highest_backup = max_backup_version(base_versions, dir);
++ highest_backup = max_backup_version(base_versions, dirname(path));
+ free(base_versions);
++ free(path);
+ if (backup_type == numbered_existing && highest_backup == 0)
+ return concat(file, simple_backup_suffix);
+ return make_version_name(file, highest_backup + 1);
+--
+2.12.2
+