summaryrefslogtreecommitdiffstats
path: root/usr.bin/patch
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/patch')
-rw-r--r--usr.bin/patch/pch.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index 4c06bbf..411dcac 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -1537,10 +1537,16 @@ best_name(const struct file_name *names, bool assume_exists)
continue;
if ((tmp = num_components(names[i].path)) > min_components)
continue;
- min_components = tmp;
+ if (tmp < min_components) {
+ min_components = tmp;
+ best = names[i].path;
+ }
if ((tmp = strlen(basename(names[i].path))) > min_baselen)
continue;
- min_baselen = tmp;
+ if (tmp < min_baselen) {
+ min_baselen = tmp;
+ best = names[i].path;
+ }
if ((tmp = strlen(names[i].path)) > min_len)
continue;
min_len = tmp;
OpenPOWER on IntegriCloud