From 3f6bb561dbc76f9bb5ba3dd12c4a0f68a467f497 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 3 Sep 2001 19:37:15 +0000 Subject: [PATCH] SUSv2 specifies that if the extension is identical to the basename, it should not be removed. Patch backport from Matt Kraai --- busybox/basename.c | 2 +- busybox/coreutils/basename.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/busybox/basename.c b/busybox/basename.c index b83f387c2..c15afd533 100644 --- a/busybox/basename.c +++ b/busybox/basename.c @@ -44,7 +44,7 @@ extern int basename_main(int argc, char **argv) argv++; n = strlen(*argv); m = strlen(s); - if (m>=n && strncmp(s+m-n, *argv, n)==0) + if (m>n && strncmp(s+m-n, *argv, n)==0) s[m-n] = '\0'; } puts(s); diff --git a/busybox/coreutils/basename.c b/busybox/coreutils/basename.c index b83f387c2..c15afd533 100644 --- a/busybox/coreutils/basename.c +++ b/busybox/coreutils/basename.c @@ -44,7 +44,7 @@ extern int basename_main(int argc, char **argv) argv++; n = strlen(*argv); m = strlen(s); - if (m>=n && strncmp(s+m-n, *argv, n)==0) + if (m>n && strncmp(s+m-n, *argv, n)==0) s[m-n] = '\0'; } puts(s); -- 2.25.1