Tue Apr 27 20:31:13 1999 Norbert Warmuth <nwarmuth@privat.circular.de>

* src/util.c (strip_home_and_password): Don't split the path in the
middle of a directory, e.g. "/home/bofh" will not be translated to
"~h" (fixes the bug reported by Alex Fortuna <alex@rdc.ru>)
This commit is contained in:
Norbert Warmuth 1999-04-28 04:03:30 +00:00
parent 3ce320801f
commit 2c53bb4eb5
2 changed files with 9 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Tue Apr 27 20:31:13 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* util.c (strip_home_and_password): Don't split the path in the
middle of a directory, e.g. "/home/bofh" will not be translated to
"~h" (fixes the bug reported by Alex Fortuna <alex@rdc.ru>)
1999-04-25 Sergei Ivanov <svivanov@pdmi.ras.ru>
* find.c: The origin of the bug is in the function do_search (file

View File

@ -384,9 +384,11 @@ strip_password (char *p, int has_prefix)
char *strip_home_and_password(char *dir)
{
size_t len;
static char newdir [MC_MAXPATHLEN];
if (home_dir && !strncmp (dir, home_dir, strlen (home_dir))){
if (home_dir && !strncmp (dir, home_dir, len = strlen (home_dir)) &&
(dir[len] == PATH_SEP || dir[len] == '\0')){
newdir [0] = '~';
strcpy (&newdir [1], &dir [strlen (home_dir)]);
return newdir;