aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPo Lu2023-08-07 07:56:44 +0800
committerPo Lu2023-08-07 07:56:44 +0800
commit072a8a434eb0f39f6e4a0c956d3d8cf44b00cff8 (patch)
tree986dadd06bf49dff5a1c1375ab601bfd892aa20c /src
parent563df3218e91816b2a4cb442220db12ca9598a03 (diff)
parent18e7bc87521e3c48b819cfe4a113f532ba905561 (diff)
downloademacs-072a8a434eb0f39f6e4a0c956d3d8cf44b00cff8.tar.gz
emacs-072a8a434eb0f39f6e4a0c956d3d8cf44b00cff8.zip
Merge remote-tracking branch 'origin/master' into feature/android
Diffstat (limited to 'src')
-rw-r--r--src/emacs.c23
-rw-r--r--src/fileio.c6
2 files changed, 19 insertions, 10 deletions
diff --git a/src/emacs.c b/src/emacs.c
index 72f75d7890d..36914967dc7 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -3076,24 +3076,31 @@ shut_down_emacs (int sig, Lisp_Object stuff)
3076 reset_all_sys_modes (); 3076 reset_all_sys_modes ();
3077 if (sig && sig != SIGTERM) 3077 if (sig && sig != SIGTERM)
3078 { 3078 {
3079 static char const fmt[] = "Fatal error %d: %n%s\n";
3080#ifdef HAVE_HAIKU 3079#ifdef HAVE_HAIKU
3081 if (haiku_debug_on_fatal_error) 3080 if (haiku_debug_on_fatal_error)
3082 debugger ("Fatal error in Emacs"); 3081 debugger ("Fatal error in Emacs");
3083#endif 3082#endif
3084 char buf[max ((sizeof fmt - sizeof "%d%n%s\n" 3083 /* Output a "Fatal error NUM: DESC\n" diagnostic with a single write,
3084 but use multiple writes if the diagnosic is absurdly long
3085 and likely couldn't be written atomically anyway. */
3086 static char const fmt[] = "Fatal error %d: ";
3087 char buf[max ((sizeof fmt - sizeof "%d"
3085 + INT_STRLEN_BOUND (int) + 1), 3088 + INT_STRLEN_BOUND (int) + 1),
3086 min (PIPE_BUF, MAX_ALLOCA))]; 3089 min (PIPE_BUF, MAX_ALLOCA))];
3087 char const *sig_desc = safe_strsignal (sig); 3090 char const *sig_desc = safe_strsignal (sig);
3088 int nlen; 3091 size_t sig_desclen = strlen (sig_desc);
3089 int buflen = snprintf (buf, sizeof buf, fmt, sig, &nlen, sig_desc); 3092 int nlen = sprintf (buf, fmt, sig);
3090 if (0 <= buflen && buflen < sizeof buf) 3093 if (nlen + sig_desclen < sizeof buf - 1)
3091 emacs_write (STDERR_FILENO, buf, buflen); 3094 {
3095 char *p = mempcpy (buf + nlen, sig_desc, sig_desclen);
3096 *p++ = '\n';
3097 emacs_write (STDERR_FILENO, buf, p - buf);
3098 }
3092 else 3099 else
3093 { 3100 {
3094 emacs_write (STDERR_FILENO, buf, nlen); 3101 emacs_write (STDERR_FILENO, buf, nlen);
3095 emacs_write (STDERR_FILENO, sig_desc, strlen (sig_desc)); 3102 emacs_write (STDERR_FILENO, sig_desc, sig_desclen);
3096 emacs_write (STDERR_FILENO, fmt + sizeof fmt - 2, 1); 3103 emacs_write (STDERR_FILENO, "\n", 1);
3097 } 3104 }
3098 } 3105 }
3099 } 3106 }
diff --git a/src/fileio.c b/src/fileio.c
index b815a1bdd79..290481c2b5d 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2566,12 +2566,14 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal,
2566} 2566}
2567 2567
2568DEFUN ("delete-file-internal", Fdelete_file_internal, Sdelete_file_internal, 1, 1, 0, 2568DEFUN ("delete-file-internal", Fdelete_file_internal, Sdelete_file_internal, 1, 1, 0,
2569 doc: /* Delete file named FILENAME. If it is a symlink, remove the symlink. 2569 doc: /* Delete file named FILENAME; internal use only.
2570If it is a symlink, remove the symlink.
2570If file has multiple names, it continues to exist with the other names. */) 2571If file has multiple names, it continues to exist with the other names. */)
2571 (Lisp_Object filename) 2572 (Lisp_Object filename)
2572{ 2573{
2573 Lisp_Object encoded_file; 2574 Lisp_Object encoded_file;
2574 2575
2576 filename = Fexpand_file_name (filename, Qnil);
2575 encoded_file = ENCODE_FILE (filename); 2577 encoded_file = ENCODE_FILE (filename);
2576 2578
2577 if (emacs_unlink (SSDATA (encoded_file)) != 0 2579 if (emacs_unlink (SSDATA (encoded_file)) != 0
@@ -2596,7 +2598,7 @@ internal_delete_file (Lisp_Object filename)
2596{ 2598{
2597 Lisp_Object tem; 2599 Lisp_Object tem;
2598 2600
2599 tem = internal_condition_case_2 (Fdelete_file, filename, Qnil, 2601 tem = internal_condition_case_2 (Fdelete_file_internal, filename,
2600 Qt, internal_delete_file_1); 2602 Qt, internal_delete_file_1);
2601 return NILP (tem); 2603 return NILP (tem);
2602} 2604}