- Only goto_abort() if we *didnt* abort the command, making
the function seem horribly misnamed ;-) (David Benbennick).
- winio.c:
+ browser_init(), striponedir(), do_browse_from()
+ - Various memory leak fixes (David Benbennick).
do_yesno(), do_help()
- Add defined(NCURSES_MOUSE_VERSION) to macro so systems that
don't understand MEVENT will compile.
{
char *tmp;
+ assert(foo != NULL);
/* Don't strip the root dir */
- if (!strcmp(foo, "/"))
+ if (*foo == '\0' || strcmp(foo, "/") == 0)
return;
- tmp = foo + strlen(foo);
+ tmp = foo + strlen(foo) - 1;
+ assert(tmp >= foo);
if (*tmp == '/')
- tmp--;
+ *tmp = '\0';
while (*tmp != '/' && tmp != foo)
tmp--;
sprintf(filelist[i], "%s/%s", path, next->d_name);
i++;
}
+ closedir(dir);
if (*longest > COLS - 1)
*longest = COLS - 1;
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
striponedir(path);
- if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode))
+ if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
+ free(path);
path = getcwd(NULL, PATH_MAX + 1);
+ }
}
#ifndef DISABLE_OPERATINGDIR