diff options
| author | Eli Zaretskii | 2021-12-19 17:29:40 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2021-12-19 17:29:40 +0200 |
| commit | cc63704815ee4ae686a0cf86e12f7f2596dd22a3 (patch) | |
| tree | f0d6215f0f35bf3538ec3601e49bc54f0d91f0fa /src | |
| parent | 8f82a83caec9ad48a6d4abc4dc26bed67f0e89e3 (diff) | |
| download | emacs-cc63704815ee4ae686a0cf86e12f7f2596dd22a3.tar.gz emacs-cc63704815ee4ae686a0cf86e12f7f2596dd22a3.zip | |
New error symbol 'permission-denied'
* src/fileio.c (syms_of_fileio) <permission-denied>: Define the
symbol and its 'err-conditions' and 'error-message' properties.
(get_file_errno_data): Return permission-denied on EACCES.
* test/src/filelock-tests.el (filelock-tests-file-locked-p-spoiled)
(filelock-tests-unlock-spoiled)
(filelock-tests-kill-buffer-spoiled): Adapt the tests to the new
error symbol.
* doc/lispref/errors.texi (Standard Errors):
* etc/NEWS: Document 'permission-denied' error.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fileio.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/fileio.c b/src/fileio.c index a0563ccba4b..f802e4e4184 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -195,7 +195,11 @@ get_file_errno_data (char const *string, Lisp_Object name, int errorno) | |||
| 195 | if (errorno == EEXIST) | 195 | if (errorno == EEXIST) |
| 196 | return Fcons (Qfile_already_exists, errdata); | 196 | return Fcons (Qfile_already_exists, errdata); |
| 197 | else | 197 | else |
| 198 | return Fcons (errorno == ENOENT ? Qfile_missing : Qfile_error, | 198 | return Fcons (errorno == ENOENT |
| 199 | ? Qfile_missing | ||
| 200 | : (errorno == EACCES | ||
| 201 | ? Qpermission_denied | ||
| 202 | : Qfile_error), | ||
| 199 | Fcons (build_string (string), errdata)); | 203 | Fcons (build_string (string), errdata)); |
| 200 | } | 204 | } |
| 201 | 205 | ||
| @@ -6380,6 +6384,7 @@ syms_of_fileio (void) | |||
| 6380 | DEFSYM (Qfile_already_exists, "file-already-exists"); | 6384 | DEFSYM (Qfile_already_exists, "file-already-exists"); |
| 6381 | DEFSYM (Qfile_date_error, "file-date-error"); | 6385 | DEFSYM (Qfile_date_error, "file-date-error"); |
| 6382 | DEFSYM (Qfile_missing, "file-missing"); | 6386 | DEFSYM (Qfile_missing, "file-missing"); |
| 6387 | DEFSYM (Qpermission_denied, "permission-denied"); | ||
| 6383 | DEFSYM (Qfile_notify_error, "file-notify-error"); | 6388 | DEFSYM (Qfile_notify_error, "file-notify-error"); |
| 6384 | DEFSYM (Qremote_file_error, "remote-file-error"); | 6389 | DEFSYM (Qremote_file_error, "remote-file-error"); |
| 6385 | DEFSYM (Qexcl, "excl"); | 6390 | DEFSYM (Qexcl, "excl"); |
| @@ -6438,6 +6443,11 @@ behaves as if file names were encoded in `utf-8'. */); | |||
| 6438 | Fput (Qfile_missing, Qerror_message, | 6443 | Fput (Qfile_missing, Qerror_message, |
| 6439 | build_pure_c_string ("File is missing")); | 6444 | build_pure_c_string ("File is missing")); |
| 6440 | 6445 | ||
| 6446 | Fput (Qpermission_denied, Qerror_conditions, | ||
| 6447 | Fpurecopy (list3 (Qpermission_denied, Qfile_error, Qerror))); | ||
| 6448 | Fput (Qpermission_denied, Qerror_message, | ||
| 6449 | build_pure_c_string ("Cannot access file or directory")); | ||
| 6450 | |||
| 6441 | Fput (Qfile_notify_error, Qerror_conditions, | 6451 | Fput (Qfile_notify_error, Qerror_conditions, |
| 6442 | Fpurecopy (list3 (Qfile_notify_error, Qfile_error, Qerror))); | 6452 | Fpurecopy (list3 (Qfile_notify_error, Qfile_error, Qerror))); |
| 6443 | Fput (Qfile_notify_error, Qerror_message, | 6453 | Fput (Qfile_notify_error, Qerror_message, |