1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

File name completion crashed if you tried to complete file in directory

that didn't exist or you didn't have read permission.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@375 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-25 21:59:30 +00:00 committed by cras
parent cb1666cb21
commit 0bc084770c

View File

@ -193,19 +193,21 @@ GList *filename_complete(const char *path)
list = NULL;
realpath = strncmp(path, "~/", 2) != 0 ? g_strdup(path) :
g_strconcat(g_get_home_dir(), path+1, NULL);
/* get directory part of the path - expand ~/ */
realpath = convert_home(path);
dir = g_dirname(realpath);
dirp = opendir(dir);
g_free(dir);
g_free(realpath);
dir = g_dirname(path);
/* open directory for reading */
dirp = opendir(dir);
g_free(dir);
if (dirp == NULL) return NULL;
dir = g_dirname(path);
basename = g_basename(path);
len = strlen(basename);
/* add all files in directory to completion list */
while ((dp = readdir(dirp)) != NULL) {
if (dp->d_name[0] == '.') {
if (dp->d_name[1] == '\0' ||