aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--driver.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/driver.c b/driver.c
index f30f413..cca2c65 100644
--- a/driver.c
+++ b/driver.c
@@ -100,9 +100,9 @@ changeext(const char *name, const char *ext)
size_t baselen;
slash = strrchr(name, '/');
- if (!slash)
- slash = name;
- dot = strrchr(slash, '.');
+ if (slash)
+ name = slash + 1;
+ dot = strrchr(name, '.');
baselen = dot ? (size_t)(--dot - name + 1) : strlen(name);
result = xmalloc(baselen + strlen(ext) + 2);
memcpy(result, name, baselen);