summaryrefslogtreecommitdiff
path: root/util2.c
diff options
context:
space:
mode:
authorWayne Davison <wayne@opencoder.net>2020-07-24 23:30:32 -0700
committerWayne Davison <wayne@opencoder.net>2020-07-24 23:30:32 -0700
commita5a9f268fe99316a48d5fa6fc768e89469fbe526 (patch)
treee58d64c55f1e1c42095d5b74d8e69037d17f5b87 /util2.c
parent0a255771f459893a05d6c91147ca541887c40e7d (diff)
downloadrsync-a5a9f268fe99316a48d5fa6fc768e89469fbe526.tar.gz
Tweak NEWS & src_file().
Diffstat (limited to 'util2.c')
-rw-r--r--util2.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/util2.c b/util2.c
index 8879c987..8b61d0b5 100644
--- a/util2.c
+++ b/util2.c
@@ -135,11 +135,8 @@ const char *src_file(const char *file)
static int prefix = -1;
if (prefix < 0) {
- const char *cp;
- for (cp = util2, prefix = 0; *cp; cp++) {
- if (*cp == '/')
- prefix = cp - util2 + 1;
- }
+ const char *cp = strrchr(util2, '/');
+ prefix = cp ? cp - util2 + 1 : 0;
}
if (prefix && strncmp(file, util2, prefix) == 0)