mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* editcmd.c (edit_canonicalize_pathname): Don't ever use
getwd(), use g_get_current_dir() instead.
This commit is contained in:
parent
48101333b5
commit
6f8e77f1fb
@ -1,5 +1,8 @@
|
||||
2001-07-19 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* editcmd.c (edit_canonicalize_pathname): Don't ever use
|
||||
getwd(), use g_get_current_dir() instead.
|
||||
|
||||
* editoptions.c (edit_options_dialog): Call edit_load_syntax()
|
||||
if user turned syntax highlighting off to unload the rules.
|
||||
|
||||
|
@ -440,27 +440,23 @@ void edit_split_filename (WEdit * edit, const char *f)
|
||||
|
||||
#ifdef GTK
|
||||
|
||||
static char cwd[1040];
|
||||
|
||||
static char *edit_canonicalize_pathname (const char *p)
|
||||
{
|
||||
char *q, *r;
|
||||
char *t = NULL;
|
||||
char *cwd;
|
||||
|
||||
if (*p != '/') {
|
||||
if (strlen (cwd) == 0) {
|
||||
#ifdef HAVE_GETCWD
|
||||
getcwd (cwd, MAX_PATH_LEN);
|
||||
#else
|
||||
getwd (cwd);
|
||||
#endif
|
||||
}
|
||||
t = malloc (strlen (cwd) + strlen (p) + 2);
|
||||
cwd = g_get_current_dir ();
|
||||
t = g_malloc (strlen (cwd) + strlen (p) + 2);
|
||||
strcpy (t, cwd);
|
||||
strcat (t, "/");
|
||||
strcat (t, p);
|
||||
g_free (cwd);
|
||||
p = t;
|
||||
}
|
||||
|
||||
r = q = malloc (strlen (p) + 2);
|
||||
while (*p) {
|
||||
if (*p != '/') {
|
||||
@ -484,8 +480,7 @@ static char *edit_canonicalize_pathname (const char *p)
|
||||
q++;
|
||||
}
|
||||
}
|
||||
if (t)
|
||||
free (t);
|
||||
g_free (t);
|
||||
*q = '\0';
|
||||
/* get rid of trailing / */
|
||||
if (r[0] && r[1])
|
||||
|
Loading…
Reference in New Issue
Block a user