mirror of
https://github.com/lhearachel/narc.git
synced 2025-06-18 21:45:34 -04:00
fix(cli-strutil): Increment basename pointer past /
This commit is contained in:
parent
a8359770b1
commit
8270f5b546
@ -207,7 +207,7 @@ static int pack(struct options *opts)
|
||||
if (opts->naix) {
|
||||
fnaix = fopen(naix, "w");
|
||||
if (fnaix == NULL) {
|
||||
FAIL("narc create: error while opening file “%s” for writing: %s\n", opts->output, strerror(errno));
|
||||
FAIL("narc create: error while opening file “%s” for writing: %s\n", naix, strerror(errno));
|
||||
}
|
||||
fwrite(index->s, 1, index->len, fnaix);
|
||||
fclose(fnaix);
|
||||
|
@ -46,6 +46,8 @@ char *basename_extend(const char *path, const char *ext)
|
||||
char *p = strrchr(path, '/');
|
||||
if (p == NULL) {
|
||||
p = (char *)path;
|
||||
} else {
|
||||
p++;
|
||||
}
|
||||
|
||||
char *buf = malloc(strlen(p) + strlen(ext) + 2);
|
||||
@ -58,6 +60,8 @@ char *basename_stem_extend(const char *path, const char *ext)
|
||||
char *p = strrchr(path, '/');
|
||||
if (p == NULL) {
|
||||
p = (char *)path;
|
||||
} else {
|
||||
p++;
|
||||
}
|
||||
|
||||
char *s = strrchr(p, '.');
|
||||
|
Loading…
Reference in New Issue
Block a user