Spurious warning message when entering symlink directory
- From: Christopher Gautier <krys idm fr>
- To: mc-devel gnome org
- Subject: Spurious warning message when entering symlink directory
- Date: Tue, 23 Aug 2005 16:28:46 +0200
I finally decided to crush a bug that has been annoying me for some time.
How to reproduce it:
- mkdir foo
- ln -s foo bar
- go to bar within mc
- the message 'Warning: Cannot change to %s' appears (subshell.c, line
810)
- the chdir actually works
This is a problem when paths get too long because the message causes a
scroll that destroys the window content.
I include a naive patch (over mc 4.6.1) for this.
Regards,
Christopher
diff -u -r mc-4.6.1/src/subshell.c my_mc/src/subshell.c
--- mc-4.6.1/src/subshell.c 2005-06-07 11:19:19.000000000 +0200
+++ my_mc/src/subshell.c 2005-08-23 11:03:23.000000000 +0200
@@ -807,7 +807,17 @@
if (bPathNotEq && strcmp (current_panel->cwd, ".")) {
char *cwd = strip_password (g_strdup (current_panel->cwd), 1);
- fprintf (stderr, _("Warning: Cannot change to %s.\n"), cwd);
+
+ /* Maybe we have a symlink */
+ char *sym = resolve_symlinks(cwd);
+ int err = 1;
+ if (sym) {
+ if (!strcmp(subshell_cwd, sym))
+ err = 0;
+ g_free(sym);
+ }
+ if (err)
+ fprintf (stderr, _("Warning: Cannot change to %s.\n"), cwd);
g_free (cwd);
}
}
diff -u -r mc-4.6.1/src/util.c my_mc/src/util.c
--- mc-4.6.1/src/util.c 2005-05-27 16:19:18.000000000 +0200
+++ my_mc/src/util.c 2005-08-23 10:45:27.000000000 +0200
@@ -1072,7 +1072,7 @@
return valcopy;
}
-static char *resolve_symlinks (const char *path)
+char *resolve_symlinks (const char *path)
{
char *buf, *buf2, *q, *r, c;
int len;
diff -u -r mc-4.6.1/src/util.h my_mc/src/util.h
--- mc-4.6.1/src/util.h 2005-01-13 20:20:47.000000000 +0100
+++ my_mc/src/util.h 2005-08-23 10:59:19.000000000 +0200
@@ -133,6 +133,7 @@
/* Pathname canonicalization */
void canonicalize_pathname (char *);
+char *resolve_symlinks (const char *path);
/* Misc Unix functions */
char *get_current_wd (char *buffer, int size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]