From e2abcdca396661cbe0ae2ddb13d5c2b85682c13a Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Fri, 16 Oct 2020 17:41:25 +0300 Subject: initial commit --- ...10-patch-Fix-with-musl-s-basename-dirname.patch | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 patches/0010-patch-Fix-with-musl-s-basename-dirname.patch (limited to 'patches/0010-patch-Fix-with-musl-s-basename-dirname.patch') 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 +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 + -- cgit v1.2.3