We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 151a61b commit bc95ba0Copy full SHA for bc95ba0
src/clib-init.c
@@ -54,12 +54,8 @@ static void setopt_manifest_file(command_t *self) {
54
static char *find_basepath() {
55
char cwd[4096] = {0};
56
getcwd(cwd, 4096);
57
- char *walk = cwd + strlen(cwd);
58
- while (*(--walk) != '/')
59
- ;
60
- char *basepath = malloc((size_t)(walk - cwd));
61
- strncpy(basepath, walk + 1, (size_t)(walk - cwd));
62
- return basepath;
+
+ return strdup(strrchr(cwd, '/') + 1);
63
}
64
65
static void getinput(char *buffer, size_t s) {
0 commit comments