diff options
| author | Jan Djärv | 2004-05-04 13:54:50 +0000 |
|---|---|---|
| committer | Jan Djärv | 2004-05-04 13:54:50 +0000 |
| commit | f72b5416b95d8897b009af51abf7bacede486caf (patch) | |
| tree | c310eae98d1fe5a3f79c9a3f68f254c5dce4725c | |
| parent | 6ab6679999a9edefc38be7c0866152cf076bfe17 (diff) | |
| download | emacs-f72b5416b95d8897b009af51abf7bacede486caf.tar.gz emacs-f72b5416b95d8897b009af51abf7bacede486caf.zip | |
* fileio.c (barf_or_query_if_file_exists): Use lstat.
(Frename_file): Handle renaming of symlinks across file systems.
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/fileio.c | 23 |
2 files changed, 19 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fbce94f2ecd..9ff41a4ccc0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2004-05-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * fileio.c (barf_or_query_if_file_exists): Use lstat. | ||
| 4 | (Frename_file): Handle renaming of symlinks across file systems. | ||
| 5 | |||
| 1 | 2004-05-04 Kim F. Storm <storm@cua.dk> | 6 | 2004-05-04 Kim F. Storm <storm@cua.dk> |
| 2 | 7 | ||
| 3 | * xdisp.c (Qtotal): New var. | 8 | * xdisp.c (Qtotal): New var. |
diff --git a/src/fileio.c b/src/fileio.c index 1f7fd5753b5..04068e25f89 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2349,7 +2349,7 @@ barf_or_query_if_file_exists (absname, querystring, interactive, statptr, quick) | |||
| 2349 | 2349 | ||
| 2350 | /* stat is a good way to tell whether the file exists, | 2350 | /* stat is a good way to tell whether the file exists, |
| 2351 | regardless of what access permissions it has. */ | 2351 | regardless of what access permissions it has. */ |
| 2352 | if (stat (SDATA (encoded_filename), &statbuf) >= 0) | 2352 | if (lstat (SDATA (encoded_filename), &statbuf) >= 0) |
| 2353 | { | 2353 | { |
| 2354 | if (! interactive) | 2354 | if (! interactive) |
| 2355 | Fsignal (Qfile_already_exists, | 2355 | Fsignal (Qfile_already_exists, |
| @@ -2684,11 +2684,11 @@ This is what happens in interactive use with M-x. */) | |||
| 2684 | Lisp_Object args[2]; | 2684 | Lisp_Object args[2]; |
| 2685 | #endif | 2685 | #endif |
| 2686 | Lisp_Object handler; | 2686 | Lisp_Object handler; |
| 2687 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 2687 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 2688 | Lisp_Object encoded_file, encoded_newname; | 2688 | Lisp_Object encoded_file, encoded_newname, symlink_target; |
| 2689 | 2689 | ||
| 2690 | encoded_file = encoded_newname = Qnil; | 2690 | symlink_target = encoded_file = encoded_newname = Qnil; |
| 2691 | GCPRO4 (file, newname, encoded_file, encoded_newname); | 2691 | GCPRO5 (file, newname, encoded_file, encoded_newname, symlink_target); |
| 2692 | CHECK_STRING (file); | 2692 | CHECK_STRING (file); |
| 2693 | CHECK_STRING (newname); | 2693 | CHECK_STRING (newname); |
| 2694 | file = Fexpand_file_name (file, Qnil); | 2694 | file = Fexpand_file_name (file, Qnil); |
| @@ -2725,10 +2725,15 @@ This is what happens in interactive use with M-x. */) | |||
| 2725 | { | 2725 | { |
| 2726 | if (errno == EXDEV) | 2726 | if (errno == EXDEV) |
| 2727 | { | 2727 | { |
| 2728 | Fcopy_file (file, newname, | 2728 | symlink_target = Ffile_symlink_p (file); |
| 2729 | /* We have already prompted if it was an integer, | 2729 | if (NILP (symlink_target)) |
| 2730 | so don't have copy-file prompt again. */ | 2730 | Fcopy_file (file, newname, |
| 2731 | NILP (ok_if_already_exists) ? Qnil : Qt, Qt); | 2731 | /* We have already prompted if it was an integer, |
| 2732 | so don't have copy-file prompt again. */ | ||
| 2733 | NILP (ok_if_already_exists) ? Qnil : Qt, Qt); | ||
| 2734 | else | ||
| 2735 | Fmake_symbolic_link (symlink_target, newname, | ||
| 2736 | NILP (ok_if_already_exists) ? Qnil : Qt, Qt); | ||
| 2732 | Fdelete_file (file); | 2737 | Fdelete_file (file); |
| 2733 | } | 2738 | } |
| 2734 | else | 2739 | else |