tags 329826 + patch pending thanks On Sun, Oct 16, 2005 at 07:38:57PM +0200, Bram Moolenaar wrote: > I thought this was already checked for, but now that I try I indeed see > that there is no warning for editing the same file through a symbolic > link. I'll add a remark in the todo list.
In the meantime, here's a patch that fixes the misbehaviour on vim 6.4. Cheers. -- Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy [EMAIL PROTECTED],debian.org,bononia.it} -%- http://www.bononia.it/zack/ If there's any real truth it's that the entire multidimensional infinity of the Universe is almost certainly being run by a bunch of maniacs. -!-
diff -urN vim64/src/memline.c vim64.new/src/memline.c --- vim64/src/memline.c 2005-02-17 11:02:53.000000000 +0100 +++ vim64.new/src/memline.c 2005-10-17 12:04:36.000000000 +0200 @@ -3251,6 +3251,25 @@ } } + void +resolvesymlink(fname, buf, bufsiz) + char_u *fname, *buf; + size_t bufsiz; +{ + char_u tmp[PATH_MAX]; + + if (fname == NULL) + return; + if (readlink((char *) fname, (char *) buf, bufsiz) == -1) + STRCPY(buf, fname); /* not a symlink: return fname unmodified */ + else + { /* symlink: recursively expand */ + STRCPY(tmp, buf); + while (readlink((char *) tmp, (char *) buf, bufsiz) != -1) + STRCPY(tmp, buf); + } +} + /* * make swap file name out of the file name and a directory name */ @@ -3260,6 +3279,8 @@ char_u *dir_name; { char_u *r, *s; + char_u fname[PATH_MAX]; + char_u *fname_p = NULL; #if defined(UNIX) || defined(WIN3264) /* Need _very_ long file names */ s = dir_name + STRLEN(dir_name); @@ -3275,6 +3296,11 @@ } #endif + if (buf->b_fname != NULL) + { + fname_p = fname; + resolvesymlink(buf->b_fname, fname, PATH_MAX); + } r = buf_modname( #ifdef SHORT_FNAME TRUE, @@ -3285,7 +3311,7 @@ /* Avoid problems if fname has special chars, eg <Wimp$Scrap> */ buf->b_ffname, #else - buf->b_fname, + fname_p, #endif (char_u *) #if defined(VMS) || defined(RISCOS)
signature.asc
Description: Digital signature