diff options
| author | Michael R. Mauger | 2017-08-06 20:58:08 -0400 |
|---|---|---|
| committer | Michael R. Mauger | 2017-08-06 20:58:08 -0400 |
| commit | 6e2c0929bac8d3896d0472222cd3e6b77cb24c35 (patch) | |
| tree | 62668da72d88140958ed22273a6ed6557bc61a4a /src | |
| parent | df1a71272e5cdd10b511e2ffd702ca50ddd8a773 (diff) | |
| parent | c2f1830d69f5a5e20dac6fcbf3af4d51afba92bd (diff) | |
| download | emacs-6e2c0929bac8d3896d0472222cd3e6b77cb24c35.tar.gz emacs-6e2c0929bac8d3896d0472222cd3e6b77cb24c35.zip | |
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 3 | ||||
| -rw-r--r-- | src/cmds.c | 11 | ||||
| -rw-r--r-- | src/dired.c | 71 | ||||
| -rw-r--r-- | src/eval.c | 128 | ||||
| -rw-r--r-- | src/fileio.c | 154 | ||||
| -rw-r--r-- | src/filelock.c | 3 | ||||
| -rw-r--r-- | src/gnutls.c | 370 | ||||
| -rw-r--r-- | src/gnutls.h | 5 | ||||
| -rw-r--r-- | src/keyboard.c | 3 | ||||
| -rw-r--r-- | src/lisp.h | 6 | ||||
| -rw-r--r-- | src/minibuf.c | 7 | ||||
| -rw-r--r-- | src/regex.c | 8 | ||||
| -rw-r--r-- | src/regex.h | 2 | ||||
| -rw-r--r-- | src/sysdep.c | 20 |
14 files changed, 419 insertions, 372 deletions
diff --git a/src/buffer.c b/src/buffer.c index 649ddbe1839..0d0f43e937b 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1077,7 +1077,8 @@ is first appended to NAME, to speed up finding a non-existent buffer. */) | |||
| 1077 | 1077 | ||
| 1078 | CHECK_STRING (name); | 1078 | CHECK_STRING (name); |
| 1079 | 1079 | ||
| 1080 | if (!NILP (Fstring_equal (name, ignore)) || NILP (Fget_buffer (name))) | 1080 | if ((!NILP (ignore) && !NILP (Fstring_equal (name, ignore))) |
| 1081 | || NILP (Fget_buffer (name))) | ||
| 1081 | return name; | 1082 | return name; |
| 1082 | 1083 | ||
| 1083 | if (SREF (name, 0) != ' ') /* See bug#1229. */ | 1084 | if (SREF (name, 0) != ' ') /* See bug#1229. */ |
diff --git a/src/cmds.c b/src/cmds.c index 51652d542a8..6f2db8696e9 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -268,9 +268,10 @@ Whichever character you type to run this command is inserted. | |||
| 268 | The numeric prefix argument N says how many times to repeat the insertion. | 268 | The numeric prefix argument N says how many times to repeat the insertion. |
| 269 | Before insertion, `expand-abbrev' is executed if the inserted character does | 269 | Before insertion, `expand-abbrev' is executed if the inserted character does |
| 270 | not have word syntax and the previous character in the buffer does. | 270 | not have word syntax and the previous character in the buffer does. |
| 271 | After insertion, the value of `auto-fill-function' is called if the | 271 | After insertion, `internal-auto-fill' is called if |
| 272 | `auto-fill-chars' table has a non-nil value for the inserted character. | 272 | `auto-fill-function' is non-nil and if the `auto-fill-chars' table has |
| 273 | At the end, it runs `post-self-insert-hook'. */) | 273 | a non-nil value for the inserted character. At the end, it runs |
| 274 | `post-self-insert-hook'. */) | ||
| 274 | (Lisp_Object n) | 275 | (Lisp_Object n) |
| 275 | { | 276 | { |
| 276 | CHECK_NUMBER (n); | 277 | CHECK_NUMBER (n); |
| @@ -475,7 +476,7 @@ internal_self_insert (int c, EMACS_INT n) | |||
| 475 | that. Must have the newline in place already so filling and | 476 | that. Must have the newline in place already so filling and |
| 476 | justification, if any, know where the end is going to be. */ | 477 | justification, if any, know where the end is going to be. */ |
| 477 | SET_PT_BOTH (PT - 1, PT_BYTE - 1); | 478 | SET_PT_BOTH (PT - 1, PT_BYTE - 1); |
| 478 | auto_fill_result = call0 (BVAR (current_buffer, auto_fill_function)); | 479 | auto_fill_result = call0 (Qinternal_auto_fill); |
| 479 | /* Test PT < ZV in case the auto-fill-function is strange. */ | 480 | /* Test PT < ZV in case the auto-fill-function is strange. */ |
| 480 | if (c == '\n' && PT < ZV) | 481 | if (c == '\n' && PT < ZV) |
| 481 | SET_PT_BOTH (PT + 1, PT_BYTE + 1); | 482 | SET_PT_BOTH (PT + 1, PT_BYTE + 1); |
| @@ -494,6 +495,8 @@ internal_self_insert (int c, EMACS_INT n) | |||
| 494 | void | 495 | void |
| 495 | syms_of_cmds (void) | 496 | syms_of_cmds (void) |
| 496 | { | 497 | { |
| 498 | DEFSYM (Qinternal_auto_fill, "internal-auto-fill"); | ||
| 499 | |||
| 497 | DEFSYM (Qundo_auto_amalgamate, "undo-auto-amalgamate"); | 500 | DEFSYM (Qundo_auto_amalgamate, "undo-auto-amalgamate"); |
| 498 | DEFSYM (Qundo_auto__this_command_amalgamating, | 501 | DEFSYM (Qundo_auto__this_command_amalgamating, |
| 499 | "undo-auto--this-command-amalgamating"); | 502 | "undo-auto--this-command-amalgamating"); |
diff --git a/src/dired.c b/src/dired.c index 5ea00fb8db4..288ba6b1038 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -64,6 +64,21 @@ dirent_namelen (struct dirent *dp) | |||
| 64 | #endif | 64 | #endif |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | #ifndef HAVE_STRUCT_DIRENT_D_TYPE | ||
| 68 | enum { DT_UNKNOWN, DT_DIR, DT_LNK }; | ||
| 69 | #endif | ||
| 70 | |||
| 71 | /* Return the file type of DP. */ | ||
| 72 | static int | ||
| 73 | dirent_type (struct dirent *dp) | ||
| 74 | { | ||
| 75 | #ifdef HAVE_STRUCT_DIRENT_D_TYPE | ||
| 76 | return dp->d_type; | ||
| 77 | #else | ||
| 78 | return DT_UNKNOWN; | ||
| 79 | #endif | ||
| 80 | } | ||
| 81 | |||
| 67 | static DIR * | 82 | static DIR * |
| 68 | open_directory (Lisp_Object dirname, int *fdp) | 83 | open_directory (Lisp_Object dirname, int *fdp) |
| 69 | { | 84 | { |
| @@ -434,7 +449,7 @@ is matched against file and directory names relative to DIRECTORY. */) | |||
| 434 | return file_name_completion (file, directory, 1, Qnil); | 449 | return file_name_completion (file, directory, 1, Qnil); |
| 435 | } | 450 | } |
| 436 | 451 | ||
| 437 | static int file_name_completion_stat (int, struct dirent *, struct stat *); | 452 | static bool file_name_completion_dirp (int, struct dirent *, ptrdiff_t); |
| 438 | 453 | ||
| 439 | static Lisp_Object | 454 | static Lisp_Object |
| 440 | file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | 455 | file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, |
| @@ -448,7 +463,6 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | |||
| 448 | Lisp_Object bestmatch, tem, elt, name; | 463 | Lisp_Object bestmatch, tem, elt, name; |
| 449 | Lisp_Object encoded_file; | 464 | Lisp_Object encoded_file; |
| 450 | Lisp_Object encoded_dir; | 465 | Lisp_Object encoded_dir; |
| 451 | struct stat st; | ||
| 452 | bool directoryp; | 466 | bool directoryp; |
| 453 | /* If not INCLUDEALL, exclude files in completion-ignored-extensions as | 467 | /* If not INCLUDEALL, exclude files in completion-ignored-extensions as |
| 454 | well as "." and "..". Until shown otherwise, assume we can't exclude | 468 | well as "." and "..". Until shown otherwise, assume we can't exclude |
| @@ -512,10 +526,21 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag, | |||
| 512 | >= 0)) | 526 | >= 0)) |
| 513 | continue; | 527 | continue; |
| 514 | 528 | ||
| 515 | if (file_name_completion_stat (fd, dp, &st) < 0) | 529 | switch (dirent_type (dp)) |
| 516 | continue; | 530 | { |
| 531 | case DT_DIR: | ||
| 532 | directoryp = true; | ||
| 533 | break; | ||
| 534 | |||
| 535 | case DT_LNK: case DT_UNKNOWN: | ||
| 536 | directoryp = file_name_completion_dirp (fd, dp, len); | ||
| 537 | break; | ||
| 538 | |||
| 539 | default: | ||
| 540 | directoryp = false; | ||
| 541 | break; | ||
| 542 | } | ||
| 517 | 543 | ||
| 518 | directoryp = S_ISDIR (st.st_mode) != 0; | ||
| 519 | tem = Qnil; | 544 | tem = Qnil; |
| 520 | /* If all_flag is set, always include all. | 545 | /* If all_flag is set, always include all. |
| 521 | It would not actually be helpful to the user to ignore any possible | 546 | It would not actually be helpful to the user to ignore any possible |
| @@ -781,32 +806,18 @@ scmp (const char *s1, const char *s2, ptrdiff_t len) | |||
| 781 | return len - l; | 806 | return len - l; |
| 782 | } | 807 | } |
| 783 | 808 | ||
| 784 | static int | 809 | /* Return true if in the directory FD the directory entry DP, whose |
| 785 | file_name_completion_stat (int fd, struct dirent *dp, struct stat *st_addr) | 810 | string length is LEN, is that of a subdirectory that can be searched. */ |
| 811 | static bool | ||
| 812 | file_name_completion_dirp (int fd, struct dirent *dp, ptrdiff_t len) | ||
| 786 | { | 813 | { |
| 787 | int value; | 814 | USE_SAFE_ALLOCA; |
| 788 | 815 | char *subdir_name = SAFE_ALLOCA (len + 2); | |
| 789 | #ifdef MSDOS | 816 | memcpy (subdir_name, dp->d_name, len); |
| 790 | /* Some fields of struct stat are *very* expensive to compute on MS-DOS, | 817 | strcpy (subdir_name + len, "/"); |
| 791 | but aren't required here. Avoid computing the following fields: | 818 | bool dirp = faccessat (fd, subdir_name, F_OK, AT_EACCESS) == 0; |
| 792 | st_inode, st_size and st_nlink for directories, and the execute bits | 819 | SAFE_FREE (); |
| 793 | in st_mode for non-directory files with non-standard extensions. */ | 820 | return dirp; |
| 794 | |||
| 795 | unsigned short save_djstat_flags = _djstat_flags; | ||
| 796 | |||
| 797 | _djstat_flags = _STAT_INODE | _STAT_EXEC_MAGIC | _STAT_DIRSIZE; | ||
| 798 | #endif /* MSDOS */ | ||
| 799 | |||
| 800 | /* We want to return success if a link points to a nonexistent file, | ||
| 801 | but we want to return the status for what the link points to, | ||
| 802 | in case it is a directory. */ | ||
| 803 | value = fstatat (fd, dp->d_name, st_addr, AT_SYMLINK_NOFOLLOW); | ||
| 804 | if (value == 0 && S_ISLNK (st_addr->st_mode)) | ||
| 805 | fstatat (fd, dp->d_name, st_addr, 0); | ||
| 806 | #ifdef MSDOS | ||
| 807 | _djstat_flags = save_djstat_flags; | ||
| 808 | #endif /* MSDOS */ | ||
| 809 | return value; | ||
| 810 | } | 821 | } |
| 811 | 822 | ||
| 812 | static char * | 823 | static char * |
diff --git a/src/eval.c b/src/eval.c index e5900382dee..fe2708b1bbc 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -354,10 +354,11 @@ usage: (or CONDITIONS...) */) | |||
| 354 | 354 | ||
| 355 | while (CONSP (args)) | 355 | while (CONSP (args)) |
| 356 | { | 356 | { |
| 357 | val = eval_sub (XCAR (args)); | 357 | Lisp_Object arg = XCAR (args); |
| 358 | args = XCDR (args); | ||
| 359 | val = eval_sub (arg); | ||
| 358 | if (!NILP (val)) | 360 | if (!NILP (val)) |
| 359 | break; | 361 | break; |
| 360 | args = XCDR (args); | ||
| 361 | } | 362 | } |
| 362 | 363 | ||
| 363 | return val; | 364 | return val; |
| @@ -374,10 +375,11 @@ usage: (and CONDITIONS...) */) | |||
| 374 | 375 | ||
| 375 | while (CONSP (args)) | 376 | while (CONSP (args)) |
| 376 | { | 377 | { |
| 377 | val = eval_sub (XCAR (args)); | 378 | Lisp_Object arg = XCAR (args); |
| 379 | args = XCDR (args); | ||
| 380 | val = eval_sub (arg); | ||
| 378 | if (NILP (val)) | 381 | if (NILP (val)) |
| 379 | break; | 382 | break; |
| 380 | args = XCDR (args); | ||
| 381 | } | 383 | } |
| 382 | 384 | ||
| 383 | return val; | 385 | return val; |
| @@ -397,7 +399,7 @@ usage: (if COND THEN ELSE...) */) | |||
| 397 | 399 | ||
| 398 | if (!NILP (cond)) | 400 | if (!NILP (cond)) |
| 399 | return eval_sub (Fcar (XCDR (args))); | 401 | return eval_sub (Fcar (XCDR (args))); |
| 400 | return Fprogn (XCDR (XCDR (args))); | 402 | return Fprogn (Fcdr (XCDR (args))); |
| 401 | } | 403 | } |
| 402 | 404 | ||
| 403 | DEFUN ("cond", Fcond, Scond, 0, UNEVALLED, 0, | 405 | DEFUN ("cond", Fcond, Scond, 0, UNEVALLED, 0, |
| @@ -439,8 +441,9 @@ usage: (progn BODY...) */) | |||
| 439 | 441 | ||
| 440 | while (CONSP (body)) | 442 | while (CONSP (body)) |
| 441 | { | 443 | { |
| 442 | val = eval_sub (XCAR (body)); | 444 | Lisp_Object form = XCAR (body); |
| 443 | body = XCDR (body); | 445 | body = XCDR (body); |
| 446 | val = eval_sub (form); | ||
| 444 | } | 447 | } |
| 445 | 448 | ||
| 446 | return val; | 449 | return val; |
| @@ -488,35 +491,26 @@ The return value of the `setq' form is the value of the last VAL. | |||
| 488 | usage: (setq [SYM VAL]...) */) | 491 | usage: (setq [SYM VAL]...) */) |
| 489 | (Lisp_Object args) | 492 | (Lisp_Object args) |
| 490 | { | 493 | { |
| 491 | Lisp_Object val, sym, lex_binding; | 494 | Lisp_Object val = args, tail = args; |
| 492 | 495 | ||
| 493 | val = args; | 496 | for (EMACS_INT nargs = 0; CONSP (tail); nargs += 2) |
| 494 | if (CONSP (args)) | ||
| 495 | { | 497 | { |
| 496 | Lisp_Object args_left = args; | 498 | Lisp_Object sym = XCAR (tail), lex_binding; |
| 497 | Lisp_Object numargs = Flength (args); | 499 | tail = XCDR (tail); |
| 498 | 500 | if (!CONSP (tail)) | |
| 499 | if (XINT (numargs) & 1) | 501 | xsignal2 (Qwrong_number_of_arguments, Qsetq, make_number (nargs + 1)); |
| 500 | xsignal2 (Qwrong_number_of_arguments, Qsetq, numargs); | 502 | Lisp_Object arg = XCAR (tail); |
| 501 | 503 | tail = XCDR (tail); | |
| 502 | do | 504 | val = eval_sub (arg); |
| 503 | { | 505 | /* Like for eval_sub, we do not check declared_special here since |
| 504 | val = eval_sub (Fcar (XCDR (args_left))); | 506 | it's been done when let-binding. */ |
| 505 | sym = XCAR (args_left); | 507 | if (!NILP (Vinternal_interpreter_environment) /* Mere optimization! */ |
| 506 | 508 | && SYMBOLP (sym) | |
| 507 | /* Like for eval_sub, we do not check declared_special here since | 509 | && !NILP (lex_binding |
| 508 | it's been done when let-binding. */ | 510 | = Fassq (sym, Vinternal_interpreter_environment))) |
| 509 | if (!NILP (Vinternal_interpreter_environment) /* Mere optimization! */ | 511 | XSETCDR (lex_binding, val); /* SYM is lexically bound. */ |
| 510 | && SYMBOLP (sym) | 512 | else |
| 511 | && !NILP (lex_binding | 513 | Fset (sym, val); /* SYM is dynamically bound. */ |
| 512 | = Fassq (sym, Vinternal_interpreter_environment))) | ||
| 513 | XSETCDR (lex_binding, val); /* SYM is lexically bound. */ | ||
| 514 | else | ||
| 515 | Fset (sym, val); /* SYM is dynamically bound. */ | ||
| 516 | |||
| 517 | args_left = Fcdr (XCDR (args_left)); | ||
| 518 | } | ||
| 519 | while (CONSP (args_left)); | ||
| 520 | } | 514 | } |
| 521 | 515 | ||
| 522 | return val; | 516 | return val; |
| @@ -535,7 +529,7 @@ of unexpected results when a quoted object is modified. | |||
| 535 | usage: (quote ARG) */) | 529 | usage: (quote ARG) */) |
| 536 | (Lisp_Object args) | 530 | (Lisp_Object args) |
| 537 | { | 531 | { |
| 538 | if (CONSP (XCDR (args))) | 532 | if (!NILP (XCDR (args))) |
| 539 | xsignal2 (Qwrong_number_of_arguments, Qquote, Flength (args)); | 533 | xsignal2 (Qwrong_number_of_arguments, Qquote, Flength (args)); |
| 540 | return XCAR (args); | 534 | return XCAR (args); |
| 541 | } | 535 | } |
| @@ -549,7 +543,7 @@ usage: (function ARG) */) | |||
| 549 | { | 543 | { |
| 550 | Lisp_Object quoted = XCAR (args); | 544 | Lisp_Object quoted = XCAR (args); |
| 551 | 545 | ||
| 552 | if (CONSP (XCDR (args))) | 546 | if (!NILP (XCDR (args))) |
| 553 | xsignal2 (Qwrong_number_of_arguments, Qfunction, Flength (args)); | 547 | xsignal2 (Qwrong_number_of_arguments, Qfunction, Flength (args)); |
| 554 | 548 | ||
| 555 | if (!NILP (Vinternal_interpreter_environment) | 549 | if (!NILP (Vinternal_interpreter_environment) |
| @@ -734,9 +728,9 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 734 | sym = XCAR (args); | 728 | sym = XCAR (args); |
| 735 | tail = XCDR (args); | 729 | tail = XCDR (args); |
| 736 | 730 | ||
| 737 | if (CONSP (tail)) | 731 | if (!NILP (tail)) |
| 738 | { | 732 | { |
| 739 | if (CONSP (XCDR (tail)) && CONSP (XCDR (XCDR (tail)))) | 733 | if (!NILP (XCDR (tail)) && !NILP (XCDR (XCDR (tail)))) |
| 740 | error ("Too many arguments"); | 734 | error ("Too many arguments"); |
| 741 | 735 | ||
| 742 | tem = Fdefault_boundp (sym); | 736 | tem = Fdefault_boundp (sym); |
| @@ -803,20 +797,24 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */) | |||
| 803 | Lisp_Object sym, tem; | 797 | Lisp_Object sym, tem; |
| 804 | 798 | ||
| 805 | sym = XCAR (args); | 799 | sym = XCAR (args); |
| 806 | if (CONSP (Fcdr (XCDR (XCDR (args))))) | 800 | Lisp_Object docstring = Qnil; |
| 807 | error ("Too many arguments"); | 801 | if (!NILP (XCDR (XCDR (args)))) |
| 802 | { | ||
| 803 | if (!NILP (XCDR (XCDR (XCDR (args))))) | ||
| 804 | error ("Too many arguments"); | ||
| 805 | docstring = XCAR (XCDR (XCDR (args))); | ||
| 806 | } | ||
| 808 | 807 | ||
| 809 | tem = eval_sub (Fcar (XCDR (args))); | 808 | tem = eval_sub (XCAR (XCDR (args))); |
| 810 | if (!NILP (Vpurify_flag)) | 809 | if (!NILP (Vpurify_flag)) |
| 811 | tem = Fpurecopy (tem); | 810 | tem = Fpurecopy (tem); |
| 812 | Fset_default (sym, tem); | 811 | Fset_default (sym, tem); |
| 813 | XSYMBOL (sym)->declared_special = 1; | 812 | XSYMBOL (sym)->declared_special = 1; |
| 814 | tem = Fcar (XCDR (XCDR (args))); | 813 | if (!NILP (docstring)) |
| 815 | if (!NILP (tem)) | ||
| 816 | { | 814 | { |
| 817 | if (!NILP (Vpurify_flag)) | 815 | if (!NILP (Vpurify_flag)) |
| 818 | tem = Fpurecopy (tem); | 816 | docstring = Fpurecopy (docstring); |
| 819 | Fput (sym, Qvariable_documentation, tem); | 817 | Fput (sym, Qvariable_documentation, docstring); |
| 820 | } | 818 | } |
| 821 | Fput (sym, Qrisky_local_variable, Qt); | 819 | Fput (sym, Qrisky_local_variable, Qt); |
| 822 | LOADHIST_ATTACH (sym); | 820 | LOADHIST_ATTACH (sym); |
| @@ -844,27 +842,29 @@ Each VALUEFORM can refer to the symbols already bound by this VARLIST. | |||
| 844 | usage: (let* VARLIST BODY...) */) | 842 | usage: (let* VARLIST BODY...) */) |
| 845 | (Lisp_Object args) | 843 | (Lisp_Object args) |
| 846 | { | 844 | { |
| 847 | Lisp_Object varlist, var, val, elt, lexenv; | 845 | Lisp_Object var, val, elt, lexenv; |
| 848 | ptrdiff_t count = SPECPDL_INDEX (); | 846 | ptrdiff_t count = SPECPDL_INDEX (); |
| 849 | 847 | ||
| 850 | lexenv = Vinternal_interpreter_environment; | 848 | lexenv = Vinternal_interpreter_environment; |
| 851 | 849 | ||
| 852 | for (varlist = XCAR (args); CONSP (varlist); varlist = XCDR (varlist)) | 850 | Lisp_Object varlist = XCAR (args); |
| 851 | while (CONSP (varlist)) | ||
| 853 | { | 852 | { |
| 854 | maybe_quit (); | 853 | maybe_quit (); |
| 855 | 854 | ||
| 856 | elt = XCAR (varlist); | 855 | elt = XCAR (varlist); |
| 856 | varlist = XCDR (varlist); | ||
| 857 | if (SYMBOLP (elt)) | 857 | if (SYMBOLP (elt)) |
| 858 | { | 858 | { |
| 859 | var = elt; | 859 | var = elt; |
| 860 | val = Qnil; | 860 | val = Qnil; |
| 861 | } | 861 | } |
| 862 | else if (! NILP (Fcdr (Fcdr (elt)))) | ||
| 863 | signal_error ("`let' bindings can have only one value-form", elt); | ||
| 864 | else | 862 | else |
| 865 | { | 863 | { |
| 866 | var = Fcar (elt); | 864 | var = Fcar (elt); |
| 867 | val = eval_sub (Fcar (Fcdr (elt))); | 865 | if (! NILP (Fcdr (XCDR (elt)))) |
| 866 | signal_error ("`let' bindings can have only one value-form", elt); | ||
| 867 | val = eval_sub (Fcar (XCDR (elt))); | ||
| 868 | } | 868 | } |
| 869 | 869 | ||
| 870 | if (!NILP (lexenv) && SYMBOLP (var) | 870 | if (!NILP (lexenv) && SYMBOLP (var) |
| @@ -911,33 +911,37 @@ usage: (let VARLIST BODY...) */) | |||
| 911 | CHECK_LIST (varlist); | 911 | CHECK_LIST (varlist); |
| 912 | 912 | ||
| 913 | /* Make space to hold the values to give the bound variables. */ | 913 | /* Make space to hold the values to give the bound variables. */ |
| 914 | elt = Flength (varlist); | 914 | EMACS_INT varlist_len = XFASTINT (Flength (varlist)); |
| 915 | SAFE_ALLOCA_LISP (temps, XFASTINT (elt)); | 915 | SAFE_ALLOCA_LISP (temps, varlist_len); |
| 916 | ptrdiff_t nvars = varlist_len; | ||
| 916 | 917 | ||
| 917 | /* Compute the values and store them in `temps'. */ | 918 | /* Compute the values and store them in `temps'. */ |
| 918 | 919 | ||
| 919 | for (argnum = 0; CONSP (varlist); varlist = XCDR (varlist)) | 920 | for (argnum = 0; argnum < nvars && CONSP (varlist); argnum++) |
| 920 | { | 921 | { |
| 921 | maybe_quit (); | 922 | maybe_quit (); |
| 922 | elt = XCAR (varlist); | 923 | elt = XCAR (varlist); |
| 924 | varlist = XCDR (varlist); | ||
| 923 | if (SYMBOLP (elt)) | 925 | if (SYMBOLP (elt)) |
| 924 | temps [argnum++] = Qnil; | 926 | temps[argnum] = Qnil; |
| 925 | else if (! NILP (Fcdr (Fcdr (elt)))) | 927 | else if (! NILP (Fcdr (Fcdr (elt)))) |
| 926 | signal_error ("`let' bindings can have only one value-form", elt); | 928 | signal_error ("`let' bindings can have only one value-form", elt); |
| 927 | else | 929 | else |
| 928 | temps [argnum++] = eval_sub (Fcar (Fcdr (elt))); | 930 | temps[argnum] = eval_sub (Fcar (Fcdr (elt))); |
| 929 | } | 931 | } |
| 932 | nvars = argnum; | ||
| 930 | 933 | ||
| 931 | lexenv = Vinternal_interpreter_environment; | 934 | lexenv = Vinternal_interpreter_environment; |
| 932 | 935 | ||
| 933 | varlist = XCAR (args); | 936 | varlist = XCAR (args); |
| 934 | for (argnum = 0; CONSP (varlist); varlist = XCDR (varlist)) | 937 | for (argnum = 0; argnum < nvars && CONSP (varlist); argnum++) |
| 935 | { | 938 | { |
| 936 | Lisp_Object var; | 939 | Lisp_Object var; |
| 937 | 940 | ||
| 938 | elt = XCAR (varlist); | 941 | elt = XCAR (varlist); |
| 942 | varlist = XCDR (varlist); | ||
| 939 | var = SYMBOLP (elt) ? elt : Fcar (elt); | 943 | var = SYMBOLP (elt) ? elt : Fcar (elt); |
| 940 | tem = temps[argnum++]; | 944 | tem = temps[argnum]; |
| 941 | 945 | ||
| 942 | if (!NILP (lexenv) && SYMBOLP (var) | 946 | if (!NILP (lexenv) && SYMBOLP (var) |
| 943 | && !XSYMBOL (var)->declared_special | 947 | && !XSYMBOL (var)->declared_special |
| @@ -2135,6 +2139,7 @@ eval_sub (Lisp_Object form) | |||
| 2135 | 2139 | ||
| 2136 | original_fun = XCAR (form); | 2140 | original_fun = XCAR (form); |
| 2137 | original_args = XCDR (form); | 2141 | original_args = XCDR (form); |
| 2142 | CHECK_LIST (original_args); | ||
| 2138 | 2143 | ||
| 2139 | /* This also protects them from gc. */ | 2144 | /* This also protects them from gc. */ |
| 2140 | count = record_in_backtrace (original_fun, &original_args, UNEVALLED); | 2145 | count = record_in_backtrace (original_fun, &original_args, UNEVALLED); |
| @@ -2176,15 +2181,16 @@ eval_sub (Lisp_Object form) | |||
| 2176 | 2181 | ||
| 2177 | SAFE_ALLOCA_LISP (vals, XINT (numargs)); | 2182 | SAFE_ALLOCA_LISP (vals, XINT (numargs)); |
| 2178 | 2183 | ||
| 2179 | while (!NILP (args_left)) | 2184 | while (CONSP (args_left) && argnum < XINT (numargs)) |
| 2180 | { | 2185 | { |
| 2181 | vals[argnum++] = eval_sub (Fcar (args_left)); | 2186 | Lisp_Object arg = XCAR (args_left); |
| 2182 | args_left = Fcdr (args_left); | 2187 | args_left = XCDR (args_left); |
| 2188 | vals[argnum++] = eval_sub (arg); | ||
| 2183 | } | 2189 | } |
| 2184 | 2190 | ||
| 2185 | set_backtrace_args (specpdl + count, vals, XINT (numargs)); | 2191 | set_backtrace_args (specpdl + count, vals, argnum); |
| 2186 | 2192 | ||
| 2187 | val = (XSUBR (fun)->function.aMANY) (XINT (numargs), vals); | 2193 | val = XSUBR (fun)->function.aMANY (argnum, vals); |
| 2188 | 2194 | ||
| 2189 | check_cons_list (); | 2195 | check_cons_list (); |
| 2190 | lisp_eval_depth--; | 2196 | lisp_eval_depth--; |
diff --git a/src/fileio.c b/src/fileio.c index a57d50b24e0..db760d9b22d 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2216,7 +2216,7 @@ With a prefix argument, TRASH is nil. */) | |||
| 2216 | 2216 | ||
| 2217 | encoded_file = ENCODE_FILE (filename); | 2217 | encoded_file = ENCODE_FILE (filename); |
| 2218 | 2218 | ||
| 2219 | if (unlink (SSDATA (encoded_file)) < 0) | 2219 | if (unlink (SSDATA (encoded_file)) != 0 && errno != ENOENT) |
| 2220 | report_file_error ("Removing old name", filename); | 2220 | report_file_error ("Removing old name", filename); |
| 2221 | return Qnil; | 2221 | return Qnil; |
| 2222 | } | 2222 | } |
| @@ -2311,6 +2311,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2311 | { | 2311 | { |
| 2312 | Lisp_Object handler; | 2312 | Lisp_Object handler; |
| 2313 | Lisp_Object encoded_file, encoded_newname, symlink_target; | 2313 | Lisp_Object encoded_file, encoded_newname, symlink_target; |
| 2314 | int dirp = -1; | ||
| 2314 | 2315 | ||
| 2315 | symlink_target = encoded_file = encoded_newname = Qnil; | 2316 | symlink_target = encoded_file = encoded_newname = Qnil; |
| 2316 | CHECK_STRING (file); | 2317 | CHECK_STRING (file); |
| @@ -2324,8 +2325,8 @@ This is what happens in interactive use with M-x. */) | |||
| 2324 | && (NILP (Ffile_name_case_insensitive_p (file)) | 2325 | && (NILP (Ffile_name_case_insensitive_p (file)) |
| 2325 | || NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))) | 2326 | || NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))) |
| 2326 | { | 2327 | { |
| 2327 | Lisp_Object fname = (NILP (Ffile_directory_p (file)) | 2328 | dirp = !NILP (Ffile_directory_p (file)); |
| 2328 | ? file : Fdirectory_file_name (file)); | 2329 | Lisp_Object fname = dirp ? Fdirectory_file_name (file) : file; |
| 2329 | newname = Fexpand_file_name (Ffile_name_nondirectory (fname), newname); | 2330 | newname = Fexpand_file_name (Ffile_name_nondirectory (fname), newname); |
| 2330 | } | 2331 | } |
| 2331 | else | 2332 | else |
| @@ -2344,46 +2345,69 @@ This is what happens in interactive use with M-x. */) | |||
| 2344 | encoded_newname = ENCODE_FILE (newname); | 2345 | encoded_newname = ENCODE_FILE (newname); |
| 2345 | 2346 | ||
| 2346 | /* If the filesystem is case-insensitive and the file names are | 2347 | /* If the filesystem is case-insensitive and the file names are |
| 2347 | identical but for the case, don't ask for confirmation: they | 2348 | identical but for the case, don't worry whether the destination |
| 2348 | simply want to change the letter-case of the file name. */ | 2349 | already exists: the caller simply wants to change the letter-case |
| 2349 | if ((!(file_name_case_insensitive_p (SSDATA (encoded_file))) | 2350 | of the file name. */ |
| 2350 | || NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname)))) | 2351 | bool plain_rename |
| 2351 | && ((NILP (ok_if_already_exists) || INTEGERP (ok_if_already_exists)))) | 2352 | = ((!NILP (ok_if_already_exists) && !INTEGERP (ok_if_already_exists)) |
| 2352 | barf_or_query_if_file_exists (newname, false, "rename to it", | 2353 | || (file_name_case_insensitive_p (SSDATA (encoded_file)) |
| 2353 | INTEGERP (ok_if_already_exists), false); | 2354 | && ! NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))); |
| 2354 | if (rename (SSDATA (encoded_file), SSDATA (encoded_newname)) < 0) | 2355 | |
| 2356 | int rename_errno; | ||
| 2357 | if (!plain_rename) | ||
| 2355 | { | 2358 | { |
| 2356 | int rename_errno = errno; | 2359 | if (renameat_noreplace (AT_FDCWD, SSDATA (encoded_file), |
| 2357 | if (rename_errno == EXDEV) | 2360 | AT_FDCWD, SSDATA (encoded_newname)) |
| 2361 | == 0) | ||
| 2362 | return Qnil; | ||
| 2363 | |||
| 2364 | rename_errno = errno; | ||
| 2365 | switch (rename_errno) | ||
| 2358 | { | 2366 | { |
| 2359 | ptrdiff_t count; | 2367 | case EEXIST: case EINVAL: case ENOSYS: |
| 2360 | symlink_target = Ffile_symlink_p (file); | 2368 | barf_or_query_if_file_exists (newname, rename_errno == EEXIST, |
| 2361 | if (! NILP (symlink_target)) | 2369 | "rename to it", |
| 2362 | Fmake_symbolic_link (symlink_target, newname, | 2370 | INTEGERP (ok_if_already_exists), |
| 2363 | NILP (ok_if_already_exists) ? Qnil : Qt); | 2371 | false); |
| 2364 | else if (!NILP (Ffile_directory_p (file))) | 2372 | plain_rename = true; |
| 2365 | call4 (Qcopy_directory, file, newname, Qt, Qnil); | 2373 | break; |
| 2366 | else | 2374 | } |
| 2367 | /* We have already prompted if it was an integer, so don't | 2375 | } |
| 2368 | have copy-file prompt again. */ | ||
| 2369 | Fcopy_file (file, newname, | ||
| 2370 | NILP (ok_if_already_exists) ? Qnil : Qt, | ||
| 2371 | Qt, Qt, Qt); | ||
| 2372 | 2376 | ||
| 2373 | count = SPECPDL_INDEX (); | 2377 | if (plain_rename) |
| 2374 | specbind (Qdelete_by_moving_to_trash, Qnil); | 2378 | { |
| 2379 | if (rename (SSDATA (encoded_file), SSDATA (encoded_newname)) == 0) | ||
| 2380 | return Qnil; | ||
| 2381 | rename_errno = errno; | ||
| 2382 | /* Don't prompt again. */ | ||
| 2383 | ok_if_already_exists = Qt; | ||
| 2384 | } | ||
| 2385 | else if (!NILP (ok_if_already_exists)) | ||
| 2386 | ok_if_already_exists = Qt; | ||
| 2375 | 2387 | ||
| 2376 | if (!NILP (Ffile_directory_p (file)) && NILP (symlink_target)) | 2388 | if (rename_errno != EXDEV) |
| 2377 | call2 (Qdelete_directory, file, Qt); | 2389 | report_file_errno ("Renaming", list2 (file, newname), rename_errno); |
| 2378 | else | 2390 | |
| 2379 | Fdelete_file (file, Qnil); | 2391 | symlink_target = Ffile_symlink_p (file); |
| 2380 | unbind_to (count, Qnil); | 2392 | if (!NILP (symlink_target)) |
| 2381 | } | 2393 | Fmake_symbolic_link (symlink_target, newname, ok_if_already_exists); |
| 2394 | else | ||
| 2395 | { | ||
| 2396 | if (dirp < 0) | ||
| 2397 | dirp = !NILP (Ffile_directory_p (file)); | ||
| 2398 | if (dirp) | ||
| 2399 | call4 (Qcopy_directory, file, newname, Qt, Qnil); | ||
| 2382 | else | 2400 | else |
| 2383 | report_file_errno ("Renaming", list2 (file, newname), rename_errno); | 2401 | Fcopy_file (file, newname, ok_if_already_exists, Qt, Qt, Qt); |
| 2384 | } | 2402 | } |
| 2385 | 2403 | ||
| 2386 | return Qnil; | 2404 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2405 | specbind (Qdelete_by_moving_to_trash, Qnil); | ||
| 2406 | if (dirp && NILP (symlink_target)) | ||
| 2407 | call2 (Qdelete_directory, file, Qt); | ||
| 2408 | else | ||
| 2409 | Fdelete_file (file, Qnil); | ||
| 2410 | return unbind_to (count, Qnil); | ||
| 2387 | } | 2411 | } |
| 2388 | 2412 | ||
| 2389 | DEFUN ("add-name-to-file", Fadd_name_to_file, Sadd_name_to_file, 2, 3, | 2413 | DEFUN ("add-name-to-file", Fadd_name_to_file, Sadd_name_to_file, 2, 3, |
| @@ -2425,19 +2449,21 @@ This is what happens in interactive use with M-x. */) | |||
| 2425 | encoded_file = ENCODE_FILE (file); | 2449 | encoded_file = ENCODE_FILE (file); |
| 2426 | encoded_newname = ENCODE_FILE (newname); | 2450 | encoded_newname = ENCODE_FILE (newname); |
| 2427 | 2451 | ||
| 2428 | if (NILP (ok_if_already_exists) | 2452 | if (link (SSDATA (encoded_file), SSDATA (encoded_newname)) == 0) |
| 2429 | || INTEGERP (ok_if_already_exists)) | 2453 | return Qnil; |
| 2430 | barf_or_query_if_file_exists (newname, false, "make it a new name", | ||
| 2431 | INTEGERP (ok_if_already_exists), false); | ||
| 2432 | 2454 | ||
| 2433 | unlink (SSDATA (newname)); | 2455 | if (errno == EEXIST) |
| 2434 | if (link (SSDATA (encoded_file), SSDATA (encoded_newname)) < 0) | ||
| 2435 | { | 2456 | { |
| 2436 | int link_errno = errno; | 2457 | if (NILP (ok_if_already_exists) |
| 2437 | report_file_errno ("Adding new name", list2 (file, newname), link_errno); | 2458 | || INTEGERP (ok_if_already_exists)) |
| 2459 | barf_or_query_if_file_exists (newname, true, "make it a new name", | ||
| 2460 | INTEGERP (ok_if_already_exists), false); | ||
| 2461 | unlink (SSDATA (newname)); | ||
| 2462 | if (link (SSDATA (encoded_file), SSDATA (encoded_newname)) == 0) | ||
| 2463 | return Qnil; | ||
| 2438 | } | 2464 | } |
| 2439 | 2465 | ||
| 2440 | return Qnil; | 2466 | report_file_error ("Adding new name", list2 (file, newname)); |
| 2441 | } | 2467 | } |
| 2442 | 2468 | ||
| 2443 | DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3, | 2469 | DEFUN ("make-symbolic-link", Fmake_symbolic_link, Smake_symbolic_link, 2, 3, |
| @@ -2484,31 +2510,25 @@ This happens for interactive use with M-x. */) | |||
| 2484 | encoded_target = ENCODE_FILE (target); | 2510 | encoded_target = ENCODE_FILE (target); |
| 2485 | encoded_linkname = ENCODE_FILE (linkname); | 2511 | encoded_linkname = ENCODE_FILE (linkname); |
| 2486 | 2512 | ||
| 2487 | if (NILP (ok_if_already_exists) | 2513 | if (symlink (SSDATA (encoded_target), SSDATA (encoded_linkname)) == 0) |
| 2488 | || INTEGERP (ok_if_already_exists)) | 2514 | return Qnil; |
| 2489 | barf_or_query_if_file_exists (linkname, false, "make it a link", | ||
| 2490 | INTEGERP (ok_if_already_exists), false); | ||
| 2491 | if (symlink (SSDATA (encoded_target), SSDATA (encoded_linkname)) < 0) | ||
| 2492 | { | ||
| 2493 | /* If we didn't complain already, silently delete existing file. */ | ||
| 2494 | int symlink_errno; | ||
| 2495 | if (errno == EEXIST) | ||
| 2496 | { | ||
| 2497 | unlink (SSDATA (encoded_linkname)); | ||
| 2498 | if (symlink (SSDATA (encoded_target), SSDATA (encoded_linkname)) | ||
| 2499 | >= 0) | ||
| 2500 | return Qnil; | ||
| 2501 | } | ||
| 2502 | if (errno == ENOSYS) | ||
| 2503 | xsignal1 (Qfile_error, | ||
| 2504 | build_string ("Symbolic links are not supported")); | ||
| 2505 | 2515 | ||
| 2506 | symlink_errno = errno; | 2516 | if (errno == ENOSYS) |
| 2507 | report_file_errno ("Making symbolic link", list2 (target, linkname), | 2517 | xsignal1 (Qfile_error, |
| 2508 | symlink_errno); | 2518 | build_string ("Symbolic links are not supported")); |
| 2519 | |||
| 2520 | if (errno == EEXIST) | ||
| 2521 | { | ||
| 2522 | if (NILP (ok_if_already_exists) | ||
| 2523 | || INTEGERP (ok_if_already_exists)) | ||
| 2524 | barf_or_query_if_file_exists (linkname, true, "make it a link", | ||
| 2525 | INTEGERP (ok_if_already_exists), false); | ||
| 2526 | unlink (SSDATA (encoded_linkname)); | ||
| 2527 | if (symlink (SSDATA (encoded_target), SSDATA (encoded_linkname)) == 0) | ||
| 2528 | return Qnil; | ||
| 2509 | } | 2529 | } |
| 2510 | 2530 | ||
| 2511 | return Qnil; | 2531 | report_file_error ("Making symbolic link", list2 (target, linkname)); |
| 2512 | } | 2532 | } |
| 2513 | 2533 | ||
| 2514 | 2534 | ||
diff --git a/src/filelock.c b/src/filelock.c index bfa1d63d833..dd8cb28c425 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -339,6 +339,9 @@ rename_lock_file (char const *old, char const *new, bool force) | |||
| 339 | { | 339 | { |
| 340 | struct stat st; | 340 | struct stat st; |
| 341 | 341 | ||
| 342 | int r = renameat_noreplace (AT_FDCWD, old, AT_FDCWD, new); | ||
| 343 | if (! (r < 0 && errno == ENOSYS)) | ||
| 344 | return r; | ||
| 342 | if (link (old, new) == 0) | 345 | if (link (old, new) == 0) |
| 343 | return unlink (old) == 0 || errno == ENOENT ? 0 : -1; | 346 | return unlink (old) == 0 || errno == ENOENT ? 0 : -1; |
| 344 | if (errno != ENOSYS && errno != LINKS_MIGHT_NOT_WORK) | 347 | if (errno != ENOSYS && errno != LINKS_MIGHT_NOT_WORK) |
diff --git a/src/gnutls.c b/src/gnutls.c index 59694074e16..188f995979e 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -26,22 +26,36 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | #include "coding.h" | 26 | #include "coding.h" |
| 27 | #include "buffer.h" | 27 | #include "buffer.h" |
| 28 | 28 | ||
| 29 | #ifdef HAVE_GNUTLS | 29 | #if 0x030014 <= GNUTLS_VERSION_NUMBER |
| 30 | # define HAVE_GNUTLS_X509_SYSTEM_TRUST | ||
| 31 | #endif | ||
| 30 | 32 | ||
| 31 | #ifdef WINDOWSNT | 33 | /* Although AEAD support started in GnuTLS 3.4.0 and works in 3.5.14, |
| 32 | #include <windows.h> | 34 | it was broken through at least GnuTLS 3.4.10; see: |
| 33 | #include "w32.h" | 35 | https://lists.gnu.org/archive/html/emacs-devel/2017-07/msg00992.html |
| 36 | The relevant fix seems to have been made in GnuTLS 3.5.1; see: | ||
| 37 | https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d | ||
| 38 | So, require 3.5.1. */ | ||
| 39 | #if 0x030501 <= GNUTLS_VERSION_NUMBER | ||
| 40 | # define HAVE_GNUTLS_AEAD | ||
| 34 | #endif | 41 | #endif |
| 35 | 42 | ||
| 43 | #ifdef HAVE_GNUTLS | ||
| 44 | |||
| 45 | # ifdef WINDOWSNT | ||
| 46 | # include <windows.h> | ||
| 47 | # include "w32.h" | ||
| 48 | # endif | ||
| 49 | |||
| 36 | static bool emacs_gnutls_handle_error (gnutls_session_t, int); | 50 | static bool emacs_gnutls_handle_error (gnutls_session_t, int); |
| 37 | 51 | ||
| 38 | static bool gnutls_global_initialized; | 52 | static bool gnutls_global_initialized; |
| 39 | 53 | ||
| 40 | static void gnutls_log_function (int, const char *); | 54 | static void gnutls_log_function (int, const char *); |
| 41 | static void gnutls_log_function2 (int, const char *, const char *); | 55 | static void gnutls_log_function2 (int, const char *, const char *); |
| 42 | #ifdef HAVE_GNUTLS3 | 56 | # ifdef HAVE_GNUTLS3 |
| 43 | static void gnutls_audit_log_function (gnutls_session_t, const char *); | 57 | static void gnutls_audit_log_function (gnutls_session_t, const char *); |
| 44 | #endif | 58 | # endif |
| 45 | 59 | ||
| 46 | enum extra_peer_verification | 60 | enum extra_peer_verification |
| 47 | { | 61 | { |
| @@ -49,7 +63,7 @@ enum extra_peer_verification | |||
| 49 | }; | 63 | }; |
| 50 | 64 | ||
| 51 | 65 | ||
| 52 | #ifdef WINDOWSNT | 66 | # ifdef WINDOWSNT |
| 53 | 67 | ||
| 54 | DEF_DLL_FN (gnutls_alert_description_t, gnutls_alert_get, | 68 | DEF_DLL_FN (gnutls_alert_description_t, gnutls_alert_get, |
| 55 | (gnutls_session_t)); | 69 | (gnutls_session_t)); |
| @@ -74,12 +88,10 @@ DEF_DLL_FN (int, gnutls_certificate_set_x509_crl_file, | |||
| 74 | DEF_DLL_FN (int, gnutls_certificate_set_x509_key_file, | 88 | DEF_DLL_FN (int, gnutls_certificate_set_x509_key_file, |
| 75 | (gnutls_certificate_credentials_t, const char *, const char *, | 89 | (gnutls_certificate_credentials_t, const char *, const char *, |
| 76 | gnutls_x509_crt_fmt_t)); | 90 | gnutls_x509_crt_fmt_t)); |
| 77 | # if ((GNUTLS_VERSION_MAJOR \ | 91 | # ifdef HAVE_GNUTLS_X509_SYSTEM_TRUST |
| 78 | + (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20)) \ | ||
| 79 | > 3) | ||
| 80 | DEF_DLL_FN (int, gnutls_certificate_set_x509_system_trust, | 92 | DEF_DLL_FN (int, gnutls_certificate_set_x509_system_trust, |
| 81 | (gnutls_certificate_credentials_t)); | 93 | (gnutls_certificate_credentials_t)); |
| 82 | # endif | 94 | # endif |
| 83 | DEF_DLL_FN (int, gnutls_certificate_set_x509_trust_file, | 95 | DEF_DLL_FN (int, gnutls_certificate_set_x509_trust_file, |
| 84 | (gnutls_certificate_credentials_t, const char *, | 96 | (gnutls_certificate_credentials_t, const char *, |
| 85 | gnutls_x509_crt_fmt_t)); | 97 | gnutls_x509_crt_fmt_t)); |
| @@ -96,9 +108,9 @@ DEF_DLL_FN (int, gnutls_dh_get_prime_bits, (gnutls_session_t)); | |||
| 96 | DEF_DLL_FN (int, gnutls_error_is_fatal, (int)); | 108 | DEF_DLL_FN (int, gnutls_error_is_fatal, (int)); |
| 97 | DEF_DLL_FN (int, gnutls_global_init, (void)); | 109 | DEF_DLL_FN (int, gnutls_global_init, (void)); |
| 98 | DEF_DLL_FN (void, gnutls_global_set_log_function, (gnutls_log_func)); | 110 | DEF_DLL_FN (void, gnutls_global_set_log_function, (gnutls_log_func)); |
| 99 | # ifdef HAVE_GNUTLS3 | 111 | # ifdef HAVE_GNUTLS3 |
| 100 | DEF_DLL_FN (void, gnutls_global_set_audit_log_function, (gnutls_audit_log_func)); | 112 | DEF_DLL_FN (void, gnutls_global_set_audit_log_function, (gnutls_audit_log_func)); |
| 101 | # endif | 113 | # endif |
| 102 | DEF_DLL_FN (void, gnutls_global_set_log_level, (int)); | 114 | DEF_DLL_FN (void, gnutls_global_set_log_level, (int)); |
| 103 | DEF_DLL_FN (int, gnutls_handshake, (gnutls_session_t)); | 115 | DEF_DLL_FN (int, gnutls_handshake, (gnutls_session_t)); |
| 104 | DEF_DLL_FN (int, gnutls_init, (gnutls_session_t *, unsigned int)); | 116 | DEF_DLL_FN (int, gnutls_init, (gnutls_session_t *, unsigned int)); |
| @@ -172,14 +184,13 @@ DEF_DLL_FN (const char *, gnutls_cipher_get_name, | |||
| 172 | DEF_DLL_FN (gnutls_mac_algorithm_t, gnutls_mac_get, (gnutls_session_t)); | 184 | DEF_DLL_FN (gnutls_mac_algorithm_t, gnutls_mac_get, (gnutls_session_t)); |
| 173 | DEF_DLL_FN (const char *, gnutls_mac_get_name, (gnutls_mac_algorithm_t)); | 185 | DEF_DLL_FN (const char *, gnutls_mac_get_name, (gnutls_mac_algorithm_t)); |
| 174 | 186 | ||
| 175 | # ifdef HAVE_GNUTLS3 | 187 | # ifdef HAVE_GNUTLS3 |
| 176 | DEF_DLL_FN (int, gnutls_rnd, (gnutls_rnd_level_t, void *, size_t)); | 188 | DEF_DLL_FN (int, gnutls_rnd, (gnutls_rnd_level_t, void *, size_t)); |
| 177 | DEF_DLL_FN (const gnutls_mac_algorithm_t *, gnutls_mac_list, (void)); | 189 | DEF_DLL_FN (const gnutls_mac_algorithm_t *, gnutls_mac_list, (void)); |
| 178 | DEF_DLL_FN (size_t, gnutls_mac_get_nonce_size, (gnutls_mac_algorithm_t)); | 190 | DEF_DLL_FN (size_t, gnutls_mac_get_nonce_size, (gnutls_mac_algorithm_t)); |
| 179 | DEF_DLL_FN (size_t, gnutls_mac_get_key_size, (gnutls_mac_algorithm_t)); | 191 | DEF_DLL_FN (size_t, gnutls_mac_get_key_size, (gnutls_mac_algorithm_t)); |
| 180 | DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void)); | 192 | DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void)); |
| 181 | DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t)); | 193 | DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t)); |
| 182 | # ifdef HAVE_GNUTLS3_CIPHER | ||
| 183 | DEF_DLL_FN (gnutls_cipher_algorithm_t *, gnutls_cipher_list, (void)); | 194 | DEF_DLL_FN (gnutls_cipher_algorithm_t *, gnutls_cipher_list, (void)); |
| 184 | DEF_DLL_FN (int, gnutls_cipher_get_iv_size, (gnutls_cipher_algorithm_t)); | 195 | DEF_DLL_FN (int, gnutls_cipher_get_iv_size, (gnutls_cipher_algorithm_t)); |
| 185 | DEF_DLL_FN (size_t, gnutls_cipher_get_key_size, (gnutls_cipher_algorithm_t)); | 196 | DEF_DLL_FN (size_t, gnutls_cipher_get_key_size, (gnutls_cipher_algorithm_t)); |
| @@ -194,7 +205,7 @@ DEF_DLL_FN (int, gnutls_cipher_encrypt2, | |||
| 194 | DEF_DLL_FN (void, gnutls_cipher_deinit, (gnutls_cipher_hd_t)); | 205 | DEF_DLL_FN (void, gnutls_cipher_deinit, (gnutls_cipher_hd_t)); |
| 195 | DEF_DLL_FN (int, gnutls_cipher_decrypt2, | 206 | DEF_DLL_FN (int, gnutls_cipher_decrypt2, |
| 196 | (gnutls_cipher_hd_t, const void *, size_t, void *, size_t)); | 207 | (gnutls_cipher_hd_t, const void *, size_t, void *, size_t)); |
| 197 | # ifdef HAVE_GNUTLS3_AEAD | 208 | # ifdef HAVE_GNUTLS_AEAD |
| 198 | DEF_DLL_FN (int, gnutls_aead_cipher_init, | 209 | DEF_DLL_FN (int, gnutls_aead_cipher_init, |
| 199 | (gnutls_aead_cipher_hd_t *, gnutls_cipher_algorithm_t, | 210 | (gnutls_aead_cipher_hd_t *, gnutls_cipher_algorithm_t, |
| 200 | const gnutls_datum_t *)); | 211 | const gnutls_datum_t *)); |
| @@ -205,25 +216,20 @@ DEF_DLL_FN (int, gnutls_aead_cipher_encrypt, | |||
| 205 | DEF_DLL_FN (int, gnutls_aead_cipher_decrypt, | 216 | DEF_DLL_FN (int, gnutls_aead_cipher_decrypt, |
| 206 | (gnutls_aead_cipher_hd_t, const void *, size_t, const void *, | 217 | (gnutls_aead_cipher_hd_t, const void *, size_t, const void *, |
| 207 | size_t, size_t, const void *, size_t, void *, size_t *)); | 218 | size_t, size_t, const void *, size_t, void *, size_t *)); |
| 208 | # endif /* HAVE_GNUTLS3_AEAD */ | 219 | # endif |
| 209 | # ifdef HAVE_GNUTLS3_HMAC | ||
| 210 | DEF_DLL_FN (int, gnutls_hmac_init, | 220 | DEF_DLL_FN (int, gnutls_hmac_init, |
| 211 | (gnutls_hmac_hd_t *, gnutls_mac_algorithm_t, const void *, size_t)); | 221 | (gnutls_hmac_hd_t *, gnutls_mac_algorithm_t, const void *, size_t)); |
| 212 | DEF_DLL_FN (int, gnutls_hmac_get_len, (gnutls_mac_algorithm_t)); | 222 | DEF_DLL_FN (int, gnutls_hmac_get_len, (gnutls_mac_algorithm_t)); |
| 213 | DEF_DLL_FN (int, gnutls_hmac, (gnutls_hmac_hd_t, const void *, size_t)); | 223 | DEF_DLL_FN (int, gnutls_hmac, (gnutls_hmac_hd_t, const void *, size_t)); |
| 214 | DEF_DLL_FN (void, gnutls_hmac_deinit, (gnutls_hmac_hd_t, void *)); | 224 | DEF_DLL_FN (void, gnutls_hmac_deinit, (gnutls_hmac_hd_t, void *)); |
| 215 | DEF_DLL_FN (void, gnutls_hmac_output, (gnutls_hmac_hd_t, void *)); | 225 | DEF_DLL_FN (void, gnutls_hmac_output, (gnutls_hmac_hd_t, void *)); |
| 216 | # endif /* HAVE_GNUTLS3_HMAC */ | ||
| 217 | # endif /* HAVE_GNUTLS3_CIPHER */ | ||
| 218 | # ifdef HAVE_GNUTLS3_DIGEST | ||
| 219 | DEF_DLL_FN (int, gnutls_hash_init, | 226 | DEF_DLL_FN (int, gnutls_hash_init, |
| 220 | (gnutls_hash_hd_t *, gnutls_digest_algorithm_t)); | 227 | (gnutls_hash_hd_t *, gnutls_digest_algorithm_t)); |
| 221 | DEF_DLL_FN (int, gnutls_hash_get_len, (gnutls_digest_algorithm_t)); | 228 | DEF_DLL_FN (int, gnutls_hash_get_len, (gnutls_digest_algorithm_t)); |
| 222 | DEF_DLL_FN (int, gnutls_hash, (gnutls_hash_hd_t, const void *, size_t)); | 229 | DEF_DLL_FN (int, gnutls_hash, (gnutls_hash_hd_t, const void *, size_t)); |
| 223 | DEF_DLL_FN (void, gnutls_hash_deinit, (gnutls_hash_hd_t, void *)); | 230 | DEF_DLL_FN (void, gnutls_hash_deinit, (gnutls_hash_hd_t, void *)); |
| 224 | DEF_DLL_FN (void, gnutls_hash_output, (gnutls_hash_hd_t, void *)); | 231 | DEF_DLL_FN (void, gnutls_hash_output, (gnutls_hash_hd_t, void *)); |
| 225 | # endif /* HAVE_GNUTLS3_DIGEST */ | 232 | # endif /* HAVE_GNUTLS3 */ |
| 226 | # endif /* HAVE_GNUTLS3 */ | ||
| 227 | 233 | ||
| 228 | 234 | ||
| 229 | static bool | 235 | static bool |
| @@ -249,11 +255,9 @@ init_gnutls_functions (void) | |||
| 249 | LOAD_DLL_FN (library, gnutls_certificate_set_verify_flags); | 255 | LOAD_DLL_FN (library, gnutls_certificate_set_verify_flags); |
| 250 | LOAD_DLL_FN (library, gnutls_certificate_set_x509_crl_file); | 256 | LOAD_DLL_FN (library, gnutls_certificate_set_x509_crl_file); |
| 251 | LOAD_DLL_FN (library, gnutls_certificate_set_x509_key_file); | 257 | LOAD_DLL_FN (library, gnutls_certificate_set_x509_key_file); |
| 252 | # if ((GNUTLS_VERSION_MAJOR \ | 258 | # ifdef HAVE_GNUTLS_X509_SYSTEM_TRUST |
| 253 | + (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20)) \ | ||
| 254 | > 3) | ||
| 255 | LOAD_DLL_FN (library, gnutls_certificate_set_x509_system_trust); | 259 | LOAD_DLL_FN (library, gnutls_certificate_set_x509_system_trust); |
| 256 | # endif | 260 | # endif |
| 257 | LOAD_DLL_FN (library, gnutls_certificate_set_x509_trust_file); | 261 | LOAD_DLL_FN (library, gnutls_certificate_set_x509_trust_file); |
| 258 | LOAD_DLL_FN (library, gnutls_certificate_type_get); | 262 | LOAD_DLL_FN (library, gnutls_certificate_type_get); |
| 259 | LOAD_DLL_FN (library, gnutls_certificate_verify_peers2); | 263 | LOAD_DLL_FN (library, gnutls_certificate_verify_peers2); |
| @@ -264,9 +268,9 @@ init_gnutls_functions (void) | |||
| 264 | LOAD_DLL_FN (library, gnutls_error_is_fatal); | 268 | LOAD_DLL_FN (library, gnutls_error_is_fatal); |
| 265 | LOAD_DLL_FN (library, gnutls_global_init); | 269 | LOAD_DLL_FN (library, gnutls_global_init); |
| 266 | LOAD_DLL_FN (library, gnutls_global_set_log_function); | 270 | LOAD_DLL_FN (library, gnutls_global_set_log_function); |
| 267 | # ifdef HAVE_GNUTLS3 | 271 | # ifdef HAVE_GNUTLS3 |
| 268 | LOAD_DLL_FN (library, gnutls_global_set_audit_log_function); | 272 | LOAD_DLL_FN (library, gnutls_global_set_audit_log_function); |
| 269 | # endif | 273 | # endif |
| 270 | LOAD_DLL_FN (library, gnutls_global_set_log_level); | 274 | LOAD_DLL_FN (library, gnutls_global_set_log_level); |
| 271 | LOAD_DLL_FN (library, gnutls_handshake); | 275 | LOAD_DLL_FN (library, gnutls_handshake); |
| 272 | LOAD_DLL_FN (library, gnutls_init); | 276 | LOAD_DLL_FN (library, gnutls_init); |
| @@ -309,14 +313,13 @@ init_gnutls_functions (void) | |||
| 309 | LOAD_DLL_FN (library, gnutls_cipher_get_name); | 313 | LOAD_DLL_FN (library, gnutls_cipher_get_name); |
| 310 | LOAD_DLL_FN (library, gnutls_mac_get); | 314 | LOAD_DLL_FN (library, gnutls_mac_get); |
| 311 | LOAD_DLL_FN (library, gnutls_mac_get_name); | 315 | LOAD_DLL_FN (library, gnutls_mac_get_name); |
| 312 | # ifdef HAVE_GNUTLS3 | 316 | # ifdef HAVE_GNUTLS3 |
| 313 | LOAD_DLL_FN (library, gnutls_rnd); | 317 | LOAD_DLL_FN (library, gnutls_rnd); |
| 314 | LOAD_DLL_FN (library, gnutls_mac_list); | 318 | LOAD_DLL_FN (library, gnutls_mac_list); |
| 315 | LOAD_DLL_FN (library, gnutls_mac_get_nonce_size); | 319 | LOAD_DLL_FN (library, gnutls_mac_get_nonce_size); |
| 316 | LOAD_DLL_FN (library, gnutls_mac_get_key_size); | 320 | LOAD_DLL_FN (library, gnutls_mac_get_key_size); |
| 317 | LOAD_DLL_FN (library, gnutls_digest_list); | 321 | LOAD_DLL_FN (library, gnutls_digest_list); |
| 318 | LOAD_DLL_FN (library, gnutls_digest_get_name); | 322 | LOAD_DLL_FN (library, gnutls_digest_get_name); |
| 319 | # ifdef HAVE_GNUTLS3_CIPHER | ||
| 320 | LOAD_DLL_FN (library, gnutls_cipher_list); | 323 | LOAD_DLL_FN (library, gnutls_cipher_list); |
| 321 | LOAD_DLL_FN (library, gnutls_cipher_get_iv_size); | 324 | LOAD_DLL_FN (library, gnutls_cipher_get_iv_size); |
| 322 | LOAD_DLL_FN (library, gnutls_cipher_get_key_size); | 325 | LOAD_DLL_FN (library, gnutls_cipher_get_key_size); |
| @@ -327,28 +330,23 @@ init_gnutls_functions (void) | |||
| 327 | LOAD_DLL_FN (library, gnutls_cipher_encrypt2); | 330 | LOAD_DLL_FN (library, gnutls_cipher_encrypt2); |
| 328 | LOAD_DLL_FN (library, gnutls_cipher_deinit); | 331 | LOAD_DLL_FN (library, gnutls_cipher_deinit); |
| 329 | LOAD_DLL_FN (library, gnutls_cipher_decrypt2); | 332 | LOAD_DLL_FN (library, gnutls_cipher_decrypt2); |
| 330 | # ifdef HAVE_GNUTLS3_AEAD | 333 | # ifdef HAVE_GNUTLS_AEAD |
| 331 | LOAD_DLL_FN (library, gnutls_aead_cipher_init); | 334 | LOAD_DLL_FN (library, gnutls_aead_cipher_init); |
| 332 | LOAD_DLL_FN (library, gnutls_aead_cipher_deinit); | 335 | LOAD_DLL_FN (library, gnutls_aead_cipher_deinit); |
| 333 | LOAD_DLL_FN (library, gnutls_aead_cipher_encrypt); | 336 | LOAD_DLL_FN (library, gnutls_aead_cipher_encrypt); |
| 334 | LOAD_DLL_FN (library, gnutls_aead_cipher_decrypt); | 337 | LOAD_DLL_FN (library, gnutls_aead_cipher_decrypt); |
| 335 | # endif | 338 | # endif |
| 336 | # ifdef HAVE_GNUTLS3_HMAC | ||
| 337 | LOAD_DLL_FN (library, gnutls_hmac_init); | 339 | LOAD_DLL_FN (library, gnutls_hmac_init); |
| 338 | LOAD_DLL_FN (library, gnutls_hmac_get_len); | 340 | LOAD_DLL_FN (library, gnutls_hmac_get_len); |
| 339 | LOAD_DLL_FN (library, gnutls_hmac); | 341 | LOAD_DLL_FN (library, gnutls_hmac); |
| 340 | LOAD_DLL_FN (library, gnutls_hmac_deinit); | 342 | LOAD_DLL_FN (library, gnutls_hmac_deinit); |
| 341 | LOAD_DLL_FN (library, gnutls_hmac_output); | 343 | LOAD_DLL_FN (library, gnutls_hmac_output); |
| 342 | # endif /* HAVE_GNUTLS3_HMAC */ | ||
| 343 | # endif /* HAVE_GNUTLS3_CIPHER */ | ||
| 344 | # ifdef HAVE_GNUTLS3_DIGEST | ||
| 345 | LOAD_DLL_FN (library, gnutls_hash_init); | 344 | LOAD_DLL_FN (library, gnutls_hash_init); |
| 346 | LOAD_DLL_FN (library, gnutls_hash_get_len); | 345 | LOAD_DLL_FN (library, gnutls_hash_get_len); |
| 347 | LOAD_DLL_FN (library, gnutls_hash); | 346 | LOAD_DLL_FN (library, gnutls_hash); |
| 348 | LOAD_DLL_FN (library, gnutls_hash_deinit); | 347 | LOAD_DLL_FN (library, gnutls_hash_deinit); |
| 349 | LOAD_DLL_FN (library, gnutls_hash_output); | 348 | LOAD_DLL_FN (library, gnutls_hash_output); |
| 350 | # endif | 349 | # endif /* HAVE_GNUTLS3 */ |
| 351 | # endif /* HAVE_GNUTLS3 */ | ||
| 352 | 350 | ||
| 353 | max_log_level = global_gnutls_log_level; | 351 | max_log_level = global_gnutls_log_level; |
| 354 | 352 | ||
| @@ -361,111 +359,105 @@ init_gnutls_functions (void) | |||
| 361 | return 1; | 359 | return 1; |
| 362 | } | 360 | } |
| 363 | 361 | ||
| 364 | # define gnutls_alert_get fn_gnutls_alert_get | 362 | # define gnutls_alert_get fn_gnutls_alert_get |
| 365 | # define gnutls_alert_get_name fn_gnutls_alert_get_name | 363 | # define gnutls_alert_get_name fn_gnutls_alert_get_name |
| 366 | # define gnutls_anon_allocate_client_credentials fn_gnutls_anon_allocate_client_credentials | 364 | # define gnutls_anon_allocate_client_credentials fn_gnutls_anon_allocate_client_credentials |
| 367 | # define gnutls_anon_free_client_credentials fn_gnutls_anon_free_client_credentials | 365 | # define gnutls_anon_free_client_credentials fn_gnutls_anon_free_client_credentials |
| 368 | # define gnutls_bye fn_gnutls_bye | 366 | # define gnutls_bye fn_gnutls_bye |
| 369 | # define gnutls_certificate_allocate_credentials fn_gnutls_certificate_allocate_credentials | 367 | # define gnutls_certificate_allocate_credentials fn_gnutls_certificate_allocate_credentials |
| 370 | # define gnutls_certificate_free_credentials fn_gnutls_certificate_free_credentials | 368 | # define gnutls_certificate_free_credentials fn_gnutls_certificate_free_credentials |
| 371 | # define gnutls_certificate_get_peers fn_gnutls_certificate_get_peers | 369 | # define gnutls_certificate_get_peers fn_gnutls_certificate_get_peers |
| 372 | # define gnutls_certificate_set_verify_flags fn_gnutls_certificate_set_verify_flags | 370 | # define gnutls_certificate_set_verify_flags fn_gnutls_certificate_set_verify_flags |
| 373 | # define gnutls_certificate_set_x509_crl_file fn_gnutls_certificate_set_x509_crl_file | 371 | # define gnutls_certificate_set_x509_crl_file fn_gnutls_certificate_set_x509_crl_file |
| 374 | # define gnutls_certificate_set_x509_key_file fn_gnutls_certificate_set_x509_key_file | 372 | # define gnutls_certificate_set_x509_key_file fn_gnutls_certificate_set_x509_key_file |
| 375 | # define gnutls_certificate_set_x509_system_trust fn_gnutls_certificate_set_x509_system_trust | 373 | # define gnutls_certificate_set_x509_system_trust fn_gnutls_certificate_set_x509_system_trust |
| 376 | # define gnutls_certificate_set_x509_trust_file fn_gnutls_certificate_set_x509_trust_file | 374 | # define gnutls_certificate_set_x509_trust_file fn_gnutls_certificate_set_x509_trust_file |
| 377 | # define gnutls_certificate_type_get fn_gnutls_certificate_type_get | 375 | # define gnutls_certificate_type_get fn_gnutls_certificate_type_get |
| 378 | # define gnutls_certificate_verify_peers2 fn_gnutls_certificate_verify_peers2 | 376 | # define gnutls_certificate_verify_peers2 fn_gnutls_certificate_verify_peers2 |
| 379 | # define gnutls_cipher_get fn_gnutls_cipher_get | 377 | # define gnutls_cipher_get fn_gnutls_cipher_get |
| 380 | # define gnutls_cipher_get_name fn_gnutls_cipher_get_name | 378 | # define gnutls_cipher_get_name fn_gnutls_cipher_get_name |
| 381 | # define gnutls_credentials_set fn_gnutls_credentials_set | 379 | # define gnutls_credentials_set fn_gnutls_credentials_set |
| 382 | # define gnutls_deinit fn_gnutls_deinit | 380 | # define gnutls_deinit fn_gnutls_deinit |
| 383 | # define gnutls_dh_get_prime_bits fn_gnutls_dh_get_prime_bits | 381 | # define gnutls_dh_get_prime_bits fn_gnutls_dh_get_prime_bits |
| 384 | # define gnutls_dh_set_prime_bits fn_gnutls_dh_set_prime_bits | 382 | # define gnutls_dh_set_prime_bits fn_gnutls_dh_set_prime_bits |
| 385 | # define gnutls_error_is_fatal fn_gnutls_error_is_fatal | 383 | # define gnutls_error_is_fatal fn_gnutls_error_is_fatal |
| 386 | # define gnutls_global_init fn_gnutls_global_init | 384 | # define gnutls_global_init fn_gnutls_global_init |
| 387 | # define gnutls_global_set_audit_log_function fn_gnutls_global_set_audit_log_function | 385 | # define gnutls_global_set_audit_log_function fn_gnutls_global_set_audit_log_function |
| 388 | # define gnutls_global_set_log_function fn_gnutls_global_set_log_function | 386 | # define gnutls_global_set_log_function fn_gnutls_global_set_log_function |
| 389 | # define gnutls_global_set_log_level fn_gnutls_global_set_log_level | 387 | # define gnutls_global_set_log_level fn_gnutls_global_set_log_level |
| 390 | # define gnutls_handshake fn_gnutls_handshake | 388 | # define gnutls_handshake fn_gnutls_handshake |
| 391 | # define gnutls_init fn_gnutls_init | 389 | # define gnutls_init fn_gnutls_init |
| 392 | # define gnutls_kx_get fn_gnutls_kx_get | 390 | # define gnutls_kx_get fn_gnutls_kx_get |
| 393 | # define gnutls_kx_get_name fn_gnutls_kx_get_name | 391 | # define gnutls_kx_get_name fn_gnutls_kx_get_name |
| 394 | # define gnutls_mac_get fn_gnutls_mac_get | 392 | # define gnutls_mac_get fn_gnutls_mac_get |
| 395 | # define gnutls_mac_get_name fn_gnutls_mac_get_name | 393 | # define gnutls_mac_get_name fn_gnutls_mac_get_name |
| 396 | # define gnutls_pk_algorithm_get_name fn_gnutls_pk_algorithm_get_name | 394 | # define gnutls_pk_algorithm_get_name fn_gnutls_pk_algorithm_get_name |
| 397 | # define gnutls_pk_bits_to_sec_param fn_gnutls_pk_bits_to_sec_param | 395 | # define gnutls_pk_bits_to_sec_param fn_gnutls_pk_bits_to_sec_param |
| 398 | # define gnutls_priority_set_direct fn_gnutls_priority_set_direct | 396 | # define gnutls_priority_set_direct fn_gnutls_priority_set_direct |
| 399 | # define gnutls_protocol_get_name fn_gnutls_protocol_get_name | 397 | # define gnutls_protocol_get_name fn_gnutls_protocol_get_name |
| 400 | # define gnutls_protocol_get_version fn_gnutls_protocol_get_version | 398 | # define gnutls_protocol_get_version fn_gnutls_protocol_get_version |
| 401 | # define gnutls_record_check_pending fn_gnutls_record_check_pending | 399 | # define gnutls_record_check_pending fn_gnutls_record_check_pending |
| 402 | # define gnutls_record_recv fn_gnutls_record_recv | 400 | # define gnutls_record_recv fn_gnutls_record_recv |
| 403 | # define gnutls_record_send fn_gnutls_record_send | 401 | # define gnutls_record_send fn_gnutls_record_send |
| 404 | # define gnutls_sec_param_get_name fn_gnutls_sec_param_get_name | 402 | # define gnutls_sec_param_get_name fn_gnutls_sec_param_get_name |
| 405 | # define gnutls_server_name_set fn_gnutls_server_name_set | 403 | # define gnutls_server_name_set fn_gnutls_server_name_set |
| 406 | # define gnutls_sign_get_name fn_gnutls_sign_get_name | 404 | # define gnutls_sign_get_name fn_gnutls_sign_get_name |
| 407 | # define gnutls_strerror fn_gnutls_strerror | 405 | # define gnutls_strerror fn_gnutls_strerror |
| 408 | # define gnutls_transport_set_errno fn_gnutls_transport_set_errno | 406 | # define gnutls_transport_set_errno fn_gnutls_transport_set_errno |
| 409 | # define gnutls_transport_set_ptr2 fn_gnutls_transport_set_ptr2 | 407 | # define gnutls_transport_set_ptr2 fn_gnutls_transport_set_ptr2 |
| 410 | # define gnutls_transport_set_pull_function fn_gnutls_transport_set_pull_function | 408 | # define gnutls_transport_set_pull_function fn_gnutls_transport_set_pull_function |
| 411 | # define gnutls_transport_set_push_function fn_gnutls_transport_set_push_function | 409 | # define gnutls_transport_set_push_function fn_gnutls_transport_set_push_function |
| 412 | # define gnutls_x509_crt_check_hostname fn_gnutls_x509_crt_check_hostname | 410 | # define gnutls_x509_crt_check_hostname fn_gnutls_x509_crt_check_hostname |
| 413 | # define gnutls_x509_crt_check_issuer fn_gnutls_x509_crt_check_issuer | 411 | # define gnutls_x509_crt_check_issuer fn_gnutls_x509_crt_check_issuer |
| 414 | # define gnutls_x509_crt_deinit fn_gnutls_x509_crt_deinit | 412 | # define gnutls_x509_crt_deinit fn_gnutls_x509_crt_deinit |
| 415 | # define gnutls_x509_crt_get_activation_time fn_gnutls_x509_crt_get_activation_time | 413 | # define gnutls_x509_crt_get_activation_time fn_gnutls_x509_crt_get_activation_time |
| 416 | # define gnutls_x509_crt_get_dn fn_gnutls_x509_crt_get_dn | 414 | # define gnutls_x509_crt_get_dn fn_gnutls_x509_crt_get_dn |
| 417 | # define gnutls_x509_crt_get_expiration_time fn_gnutls_x509_crt_get_expiration_time | 415 | # define gnutls_x509_crt_get_expiration_time fn_gnutls_x509_crt_get_expiration_time |
| 418 | # define gnutls_x509_crt_get_fingerprint fn_gnutls_x509_crt_get_fingerprint | 416 | # define gnutls_x509_crt_get_fingerprint fn_gnutls_x509_crt_get_fingerprint |
| 419 | # define gnutls_x509_crt_get_issuer_dn fn_gnutls_x509_crt_get_issuer_dn | 417 | # define gnutls_x509_crt_get_issuer_dn fn_gnutls_x509_crt_get_issuer_dn |
| 420 | # define gnutls_x509_crt_get_issuer_unique_id fn_gnutls_x509_crt_get_issuer_unique_id | 418 | # define gnutls_x509_crt_get_issuer_unique_id fn_gnutls_x509_crt_get_issuer_unique_id |
| 421 | # define gnutls_x509_crt_get_key_id fn_gnutls_x509_crt_get_key_id | 419 | # define gnutls_x509_crt_get_key_id fn_gnutls_x509_crt_get_key_id |
| 422 | # define gnutls_x509_crt_get_pk_algorithm fn_gnutls_x509_crt_get_pk_algorithm | 420 | # define gnutls_x509_crt_get_pk_algorithm fn_gnutls_x509_crt_get_pk_algorithm |
| 423 | # define gnutls_x509_crt_get_serial fn_gnutls_x509_crt_get_serial | 421 | # define gnutls_x509_crt_get_serial fn_gnutls_x509_crt_get_serial |
| 424 | # define gnutls_x509_crt_get_signature_algorithm fn_gnutls_x509_crt_get_signature_algorithm | 422 | # define gnutls_x509_crt_get_signature_algorithm fn_gnutls_x509_crt_get_signature_algorithm |
| 425 | # define gnutls_x509_crt_get_subject_unique_id fn_gnutls_x509_crt_get_subject_unique_id | 423 | # define gnutls_x509_crt_get_subject_unique_id fn_gnutls_x509_crt_get_subject_unique_id |
| 426 | # define gnutls_x509_crt_get_version fn_gnutls_x509_crt_get_version | 424 | # define gnutls_x509_crt_get_version fn_gnutls_x509_crt_get_version |
| 427 | # define gnutls_x509_crt_import fn_gnutls_x509_crt_import | 425 | # define gnutls_x509_crt_import fn_gnutls_x509_crt_import |
| 428 | # define gnutls_x509_crt_init fn_gnutls_x509_crt_init | 426 | # define gnutls_x509_crt_init fn_gnutls_x509_crt_init |
| 429 | # ifdef HAVE_GNUTLS3 | 427 | # ifdef HAVE_GNUTLS3 |
| 430 | # define gnutls_rnd fn_gnutls_rnd | 428 | # define gnutls_rnd fn_gnutls_rnd |
| 431 | # define gnutls_mac_list fn_gnutls_mac_list | 429 | # define gnutls_mac_list fn_gnutls_mac_list |
| 432 | # define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size | 430 | # define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size |
| 433 | # define gnutls_mac_get_key_size fn_gnutls_mac_get_key_size | 431 | # define gnutls_mac_get_key_size fn_gnutls_mac_get_key_size |
| 434 | # define gnutls_digest_list fn_gnutls_digest_list | 432 | # define gnutls_digest_list fn_gnutls_digest_list |
| 435 | # define gnutls_digest_get_name fn_gnutls_digest_get_name | 433 | # define gnutls_digest_get_name fn_gnutls_digest_get_name |
| 436 | # ifdef HAVE_GNUTLS3_CIPHER | 434 | # define gnutls_cipher_list fn_gnutls_cipher_list |
| 437 | # define gnutls_cipher_list fn_gnutls_cipher_list | 435 | # define gnutls_cipher_get_iv_size fn_gnutls_cipher_get_iv_size |
| 438 | # define gnutls_cipher_get_iv_size fn_gnutls_cipher_get_iv_size | 436 | # define gnutls_cipher_get_key_size fn_gnutls_cipher_get_key_size |
| 439 | # define gnutls_cipher_get_key_size fn_gnutls_cipher_get_key_size | 437 | # define gnutls_cipher_get_block_size fn_gnutls_cipher_get_block_size |
| 440 | # define gnutls_cipher_get_block_size fn_gnutls_cipher_get_block_size | 438 | # define gnutls_cipher_get_tag_size fn_gnutls_cipher_get_tag_size |
| 441 | # define gnutls_cipher_get_tag_size fn_gnutls_cipher_get_tag_size | 439 | # define gnutls_cipher_init fn_gnutls_cipher_init |
| 442 | # define gnutls_cipher_init fn_gnutls_cipher_init | 440 | # define gnutls_cipher_set_iv fn_gnutls_cipher_set_iv |
| 443 | # define gnutls_cipher_set_iv fn_gnutls_cipher_set_iv | 441 | # define gnutls_cipher_encrypt2 fn_gnutls_cipher_encrypt2 |
| 444 | # define gnutls_cipher_encrypt2 fn_gnutls_cipher_encrypt2 | 442 | # define gnutls_cipher_decrypt2 fn_gnutls_cipher_decrypt2 |
| 445 | # define gnutls_cipher_decrypt2 fn_gnutls_cipher_decrypt2 | 443 | # define gnutls_cipher_deinit fn_gnutls_cipher_deinit |
| 446 | # define gnutls_cipher_deinit fn_gnutls_cipher_deinit | 444 | # ifdef HAVE_GNUTLS_AEAD |
| 447 | # ifdef HAVE_GNUTLS3_AEAD | 445 | # define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt |
| 448 | # define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt | 446 | # define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt |
| 449 | # define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt | 447 | # define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init |
| 450 | # define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init | 448 | # define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit |
| 451 | # define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit | 449 | # endif |
| 452 | # endif /* HAVE_GNUTLS3_AEAD */ | 450 | # define gnutls_hmac_init fn_gnutls_hmac_init |
| 453 | # ifdef HAVE_GNUTLS3_HMAC | 451 | # define gnutls_hmac_get_len fn_gnutls_hmac_get_len |
| 454 | # define gnutls_hmac_init fn_gnutls_hmac_init | 452 | # define gnutls_hmac fn_gnutls_hmac |
| 455 | # define gnutls_hmac_get_len fn_gnutls_hmac_get_len | 453 | # define gnutls_hmac_deinit fn_gnutls_hmac_deinit |
| 456 | # define gnutls_hmac fn_gnutls_hmac | 454 | # define gnutls_hmac_output fn_gnutls_hmac_output |
| 457 | # define gnutls_hmac_deinit fn_gnutls_hmac_deinit | 455 | # define gnutls_hash_init fn_gnutls_hash_init |
| 458 | # define gnutls_hmac_output fn_gnutls_hmac_output | 456 | # define gnutls_hash_get_len fn_gnutls_hash_get_len |
| 459 | # endif /* HAVE_GNUTLS3_HMAC */ | 457 | # define gnutls_hash fn_gnutls_hash |
| 460 | # endif /* HAVE_GNUTLS3_CIPHER */ | 458 | # define gnutls_hash_deinit fn_gnutls_hash_deinit |
| 461 | # ifdef HAVE_GNUTLS3_DIGEST | 459 | # define gnutls_hash_output fn_gnutls_hash_output |
| 462 | # define gnutls_hash_init fn_gnutls_hash_init | 460 | # endif /* HAVE_GNUTLS3 */ |
| 463 | # define gnutls_hash_get_len fn_gnutls_hash_get_len | ||
| 464 | # define gnutls_hash fn_gnutls_hash | ||
| 465 | # define gnutls_hash_deinit fn_gnutls_hash_deinit | ||
| 466 | # define gnutls_hash_output fn_gnutls_hash_output | ||
| 467 | # endif | ||
| 468 | # endif /* HAVE_GNUTLS3 */ | ||
| 469 | 461 | ||
| 470 | /* This wrapper is called from fns.c, which doesn't know about the | 462 | /* This wrapper is called from fns.c, which doesn't know about the |
| 471 | LOAD_DLL_FN stuff above. */ | 463 | LOAD_DLL_FN stuff above. */ |
| @@ -475,7 +467,7 @@ w32_gnutls_rnd (gnutls_rnd_level_t level, void *data, size_t len) | |||
| 475 | return gnutls_rnd (level, data, len); | 467 | return gnutls_rnd (level, data, len); |
| 476 | } | 468 | } |
| 477 | 469 | ||
| 478 | #endif /* WINDOWSNT */ | 470 | # endif /* WINDOWSNT */ |
| 479 | 471 | ||
| 480 | 472 | ||
| 481 | /* Report memory exhaustion if ERR is an out-of-memory indication. */ | 473 | /* Report memory exhaustion if ERR is an out-of-memory indication. */ |
| @@ -489,7 +481,7 @@ check_memory_full (int err) | |||
| 489 | memory_full (0); | 481 | memory_full (0); |
| 490 | } | 482 | } |
| 491 | 483 | ||
| 492 | #ifdef HAVE_GNUTLS3 | 484 | # ifdef HAVE_GNUTLS3 |
| 493 | /* Log a simple audit message. */ | 485 | /* Log a simple audit message. */ |
| 494 | static void | 486 | static void |
| 495 | gnutls_audit_log_function (gnutls_session_t session, const char *string) | 487 | gnutls_audit_log_function (gnutls_session_t session, const char *string) |
| @@ -499,7 +491,7 @@ gnutls_audit_log_function (gnutls_session_t session, const char *string) | |||
| 499 | message ("gnutls.c: [audit] %s", string); | 491 | message ("gnutls.c: [audit] %s", string); |
| 500 | } | 492 | } |
| 501 | } | 493 | } |
| 502 | #endif | 494 | # endif |
| 503 | 495 | ||
| 504 | /* Log a simple message. */ | 496 | /* Log a simple message. */ |
| 505 | static void | 497 | static void |
| @@ -552,7 +544,7 @@ gnutls_try_handshake (struct Lisp_Process *proc) | |||
| 552 | return ret; | 544 | return ret; |
| 553 | } | 545 | } |
| 554 | 546 | ||
| 555 | #ifndef WINDOWSNT | 547 | # ifndef WINDOWSNT |
| 556 | static int | 548 | static int |
| 557 | emacs_gnutls_nonblock_errno (gnutls_transport_ptr_t ptr) | 549 | emacs_gnutls_nonblock_errno (gnutls_transport_ptr_t ptr) |
| 558 | { | 550 | { |
| @@ -560,13 +552,13 @@ emacs_gnutls_nonblock_errno (gnutls_transport_ptr_t ptr) | |||
| 560 | 552 | ||
| 561 | switch (err) | 553 | switch (err) |
| 562 | { | 554 | { |
| 563 | # ifdef _AIX | 555 | # ifdef _AIX |
| 564 | /* This is taken from the GnuTLS system_errno function circa 2016; | 556 | /* This is taken from the GnuTLS system_errno function circa 2016; |
| 565 | see <http://savannah.gnu.org/support/?107464>. */ | 557 | see <http://savannah.gnu.org/support/?107464>. */ |
| 566 | case 0: | 558 | case 0: |
| 567 | errno = EAGAIN; | 559 | errno = EAGAIN; |
| 568 | /* Fall through. */ | 560 | /* Fall through. */ |
| 569 | # endif | 561 | # endif |
| 570 | case EINPROGRESS: | 562 | case EINPROGRESS: |
| 571 | case ENOTCONN: | 563 | case ENOTCONN: |
| 572 | return EAGAIN; | 564 | return EAGAIN; |
| @@ -575,7 +567,7 @@ emacs_gnutls_nonblock_errno (gnutls_transport_ptr_t ptr) | |||
| 575 | return err; | 567 | return err; |
| 576 | } | 568 | } |
| 577 | } | 569 | } |
| 578 | #endif /* !WINDOWSNT */ | 570 | # endif /* !WINDOWSNT */ |
| 579 | 571 | ||
| 580 | static int | 572 | static int |
| 581 | emacs_gnutls_handshake (struct Lisp_Process *proc) | 573 | emacs_gnutls_handshake (struct Lisp_Process *proc) |
| @@ -587,7 +579,7 @@ emacs_gnutls_handshake (struct Lisp_Process *proc) | |||
| 587 | 579 | ||
| 588 | if (proc->gnutls_initstage < GNUTLS_STAGE_TRANSPORT_POINTERS_SET) | 580 | if (proc->gnutls_initstage < GNUTLS_STAGE_TRANSPORT_POINTERS_SET) |
| 589 | { | 581 | { |
| 590 | #ifdef WINDOWSNT | 582 | # ifdef WINDOWSNT |
| 591 | /* On W32 we cannot transfer socket handles between different runtime | 583 | /* On W32 we cannot transfer socket handles between different runtime |
| 592 | libraries, so we tell GnuTLS to use our special push/pull | 584 | libraries, so we tell GnuTLS to use our special push/pull |
| 593 | functions. */ | 585 | functions. */ |
| @@ -596,7 +588,7 @@ emacs_gnutls_handshake (struct Lisp_Process *proc) | |||
| 596 | (gnutls_transport_ptr_t) proc); | 588 | (gnutls_transport_ptr_t) proc); |
| 597 | gnutls_transport_set_push_function (state, &emacs_gnutls_push); | 589 | gnutls_transport_set_push_function (state, &emacs_gnutls_push); |
| 598 | gnutls_transport_set_pull_function (state, &emacs_gnutls_pull); | 590 | gnutls_transport_set_pull_function (state, &emacs_gnutls_pull); |
| 599 | #else | 591 | # else |
| 600 | /* This is how GnuTLS takes sockets: as file descriptors passed | 592 | /* This is how GnuTLS takes sockets: as file descriptors passed |
| 601 | in. For an Emacs process socket, infd and outfd are the | 593 | in. For an Emacs process socket, infd and outfd are the |
| 602 | same but we use this two-argument version for clarity. */ | 594 | same but we use this two-argument version for clarity. */ |
| @@ -606,7 +598,7 @@ emacs_gnutls_handshake (struct Lisp_Process *proc) | |||
| 606 | if (proc->is_non_blocking_client) | 598 | if (proc->is_non_blocking_client) |
| 607 | gnutls_transport_set_errno_function (state, | 599 | gnutls_transport_set_errno_function (state, |
| 608 | emacs_gnutls_nonblock_errno); | 600 | emacs_gnutls_nonblock_errno); |
| 609 | #endif | 601 | # endif |
| 610 | 602 | ||
| 611 | proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET; | 603 | proc->gnutls_initstage = GNUTLS_STAGE_TRANSPORT_POINTERS_SET; |
| 612 | } | 604 | } |
| @@ -620,13 +612,13 @@ emacs_gnutls_record_check_pending (gnutls_session_t state) | |||
| 620 | return gnutls_record_check_pending (state); | 612 | return gnutls_record_check_pending (state); |
| 621 | } | 613 | } |
| 622 | 614 | ||
| 623 | #ifdef WINDOWSNT | 615 | # ifdef WINDOWSNT |
| 624 | void | 616 | void |
| 625 | emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) | 617 | emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) |
| 626 | { | 618 | { |
| 627 | gnutls_transport_set_errno (state, err); | 619 | gnutls_transport_set_errno (state, err); |
| 628 | } | 620 | } |
| 629 | #endif | 621 | # endif |
| 630 | 622 | ||
| 631 | ptrdiff_t | 623 | ptrdiff_t |
| 632 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) | 624 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) |
| @@ -732,10 +724,10 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err) | |||
| 732 | /* Mostly ignore "The TLS connection was non-properly | 724 | /* Mostly ignore "The TLS connection was non-properly |
| 733 | terminated" message which just means that the peer closed the | 725 | terminated" message which just means that the peer closed the |
| 734 | connection. */ | 726 | connection. */ |
| 735 | #ifdef HAVE_GNUTLS3 | 727 | # ifdef HAVE_GNUTLS3 |
| 736 | if (err == GNUTLS_E_PREMATURE_TERMINATION) | 728 | if (err == GNUTLS_E_PREMATURE_TERMINATION) |
| 737 | level = 3; | 729 | level = 3; |
| 738 | #endif | 730 | # endif |
| 739 | 731 | ||
| 740 | GNUTLS_LOG2 (level, max_log_level, "fatal error:", str); | 732 | GNUTLS_LOG2 (level, max_log_level, "fatal error:", str); |
| 741 | ret = false; | 733 | ret = false; |
| @@ -1300,7 +1292,7 @@ gnutls_ip_address_p (char *string) | |||
| 1300 | return true; | 1292 | return true; |
| 1301 | } | 1293 | } |
| 1302 | 1294 | ||
| 1303 | #if 0 | 1295 | # if 0 |
| 1304 | /* Deinitialize global GnuTLS state. | 1296 | /* Deinitialize global GnuTLS state. |
| 1305 | See also `gnutls-global-init'. */ | 1297 | See also `gnutls-global-init'. */ |
| 1306 | static Lisp_Object | 1298 | static Lisp_Object |
| @@ -1313,7 +1305,7 @@ emacs_gnutls_global_deinit (void) | |||
| 1313 | 1305 | ||
| 1314 | return gnutls_make_error (GNUTLS_E_SUCCESS); | 1306 | return gnutls_make_error (GNUTLS_E_SUCCESS); |
| 1315 | } | 1307 | } |
| 1316 | #endif | 1308 | # endif |
| 1317 | 1309 | ||
| 1318 | static void ATTRIBUTE_FORMAT_PRINTF (2, 3) | 1310 | static void ATTRIBUTE_FORMAT_PRINTF (2, 3) |
| 1319 | boot_error (struct Lisp_Process *p, const char *m, ...) | 1311 | boot_error (struct Lisp_Process *p, const char *m, ...) |
| @@ -1585,9 +1577,9 @@ one trustfile (usually a CA bundle). */) | |||
| 1585 | if (TYPE_RANGED_INTEGERP (int, loglevel)) | 1577 | if (TYPE_RANGED_INTEGERP (int, loglevel)) |
| 1586 | { | 1578 | { |
| 1587 | gnutls_global_set_log_function (gnutls_log_function); | 1579 | gnutls_global_set_log_function (gnutls_log_function); |
| 1588 | #ifdef HAVE_GNUTLS3 | 1580 | # ifdef HAVE_GNUTLS3 |
| 1589 | gnutls_global_set_audit_log_function (gnutls_audit_log_function); | 1581 | gnutls_global_set_audit_log_function (gnutls_audit_log_function); |
| 1590 | #endif | 1582 | # endif |
| 1591 | gnutls_global_set_log_level (XINT (loglevel)); | 1583 | gnutls_global_set_log_level (XINT (loglevel)); |
| 1592 | max_log_level = XINT (loglevel); | 1584 | max_log_level = XINT (loglevel); |
| 1593 | XPROCESS (proc)->gnutls_log_level = max_log_level; | 1585 | XPROCESS (proc)->gnutls_log_level = max_log_level; |
| @@ -1649,8 +1641,7 @@ one trustfile (usually a CA bundle). */) | |||
| 1649 | int file_format = GNUTLS_X509_FMT_PEM; | 1641 | int file_format = GNUTLS_X509_FMT_PEM; |
| 1650 | Lisp_Object tail; | 1642 | Lisp_Object tail; |
| 1651 | 1643 | ||
| 1652 | #if GNUTLS_VERSION_MAJOR + \ | 1644 | # ifdef HAVE_GNUTLS_X509_SYSTEM_TRUST |
| 1653 | (GNUTLS_VERSION_MINOR > 0 || GNUTLS_VERSION_PATCH >= 20) > 3 | ||
| 1654 | ret = gnutls_certificate_set_x509_system_trust (x509_cred); | 1645 | ret = gnutls_certificate_set_x509_system_trust (x509_cred); |
| 1655 | if (ret < GNUTLS_E_SUCCESS) | 1646 | if (ret < GNUTLS_E_SUCCESS) |
| 1656 | { | 1647 | { |
| @@ -1658,7 +1649,7 @@ one trustfile (usually a CA bundle). */) | |||
| 1658 | GNUTLS_LOG2i (4, max_log_level, | 1649 | GNUTLS_LOG2i (4, max_log_level, |
| 1659 | "setting system trust failed with code ", ret); | 1650 | "setting system trust failed with code ", ret); |
| 1660 | } | 1651 | } |
| 1661 | #endif | 1652 | # endif |
| 1662 | 1653 | ||
| 1663 | for (tail = trustfiles; CONSP (tail); tail = XCDR (tail)) | 1654 | for (tail = trustfiles; CONSP (tail); tail = XCDR (tail)) |
| 1664 | { | 1655 | { |
| @@ -1668,12 +1659,12 @@ one trustfile (usually a CA bundle). */) | |||
| 1668 | GNUTLS_LOG2 (1, max_log_level, "setting the trustfile: ", | 1659 | GNUTLS_LOG2 (1, max_log_level, "setting the trustfile: ", |
| 1669 | SSDATA (trustfile)); | 1660 | SSDATA (trustfile)); |
| 1670 | trustfile = ENCODE_FILE (trustfile); | 1661 | trustfile = ENCODE_FILE (trustfile); |
| 1671 | #ifdef WINDOWSNT | 1662 | # ifdef WINDOWSNT |
| 1672 | /* Since GnuTLS doesn't support UTF-8 or UTF-16 encoded | 1663 | /* Since GnuTLS doesn't support UTF-8 or UTF-16 encoded |
| 1673 | file names on Windows, we need to re-encode the file | 1664 | file names on Windows, we need to re-encode the file |
| 1674 | name using the current ANSI codepage. */ | 1665 | name using the current ANSI codepage. */ |
| 1675 | trustfile = ansi_encode_filename (trustfile); | 1666 | trustfile = ansi_encode_filename (trustfile); |
| 1676 | #endif | 1667 | # endif |
| 1677 | ret = gnutls_certificate_set_x509_trust_file | 1668 | ret = gnutls_certificate_set_x509_trust_file |
| 1678 | (x509_cred, | 1669 | (x509_cred, |
| 1679 | SSDATA (trustfile), | 1670 | SSDATA (trustfile), |
| @@ -1698,9 +1689,9 @@ one trustfile (usually a CA bundle). */) | |||
| 1698 | GNUTLS_LOG2 (1, max_log_level, "setting the CRL file: ", | 1689 | GNUTLS_LOG2 (1, max_log_level, "setting the CRL file: ", |
| 1699 | SSDATA (crlfile)); | 1690 | SSDATA (crlfile)); |
| 1700 | crlfile = ENCODE_FILE (crlfile); | 1691 | crlfile = ENCODE_FILE (crlfile); |
| 1701 | #ifdef WINDOWSNT | 1692 | # ifdef WINDOWSNT |
| 1702 | crlfile = ansi_encode_filename (crlfile); | 1693 | crlfile = ansi_encode_filename (crlfile); |
| 1703 | #endif | 1694 | # endif |
| 1704 | ret = gnutls_certificate_set_x509_crl_file | 1695 | ret = gnutls_certificate_set_x509_crl_file |
| 1705 | (x509_cred, SSDATA (crlfile), file_format); | 1696 | (x509_cred, SSDATA (crlfile), file_format); |
| 1706 | 1697 | ||
| @@ -1727,10 +1718,10 @@ one trustfile (usually a CA bundle). */) | |||
| 1727 | SSDATA (certfile)); | 1718 | SSDATA (certfile)); |
| 1728 | keyfile = ENCODE_FILE (keyfile); | 1719 | keyfile = ENCODE_FILE (keyfile); |
| 1729 | certfile = ENCODE_FILE (certfile); | 1720 | certfile = ENCODE_FILE (certfile); |
| 1730 | #ifdef WINDOWSNT | 1721 | # ifdef WINDOWSNT |
| 1731 | keyfile = ansi_encode_filename (keyfile); | 1722 | keyfile = ansi_encode_filename (keyfile); |
| 1732 | certfile = ansi_encode_filename (certfile); | 1723 | certfile = ansi_encode_filename (certfile); |
| 1733 | #endif | 1724 | # endif |
| 1734 | ret = gnutls_certificate_set_x509_key_file | 1725 | ret = gnutls_certificate_set_x509_key_file |
| 1735 | (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format); | 1726 | (x509_cred, SSDATA (certfile), SSDATA (keyfile), file_format); |
| 1736 | 1727 | ||
| @@ -1755,10 +1746,10 @@ one trustfile (usually a CA bundle). */) | |||
| 1755 | 1746 | ||
| 1756 | GNUTLS_LOG (1, max_log_level, "gnutls_init"); | 1747 | GNUTLS_LOG (1, max_log_level, "gnutls_init"); |
| 1757 | int gnutls_flags = GNUTLS_CLIENT; | 1748 | int gnutls_flags = GNUTLS_CLIENT; |
| 1758 | #ifdef GNUTLS_NONBLOCK | 1749 | # ifdef GNUTLS_NONBLOCK |
| 1759 | if (XPROCESS (proc)->is_non_blocking_client) | 1750 | if (XPROCESS (proc)->is_non_blocking_client) |
| 1760 | gnutls_flags |= GNUTLS_NONBLOCK; | 1751 | gnutls_flags |= GNUTLS_NONBLOCK; |
| 1761 | #endif | 1752 | # endif |
| 1762 | ret = gnutls_init (&state, gnutls_flags); | 1753 | ret = gnutls_init (&state, gnutls_flags); |
| 1763 | XPROCESS (proc)->gnutls_state = state; | 1754 | XPROCESS (proc)->gnutls_state = state; |
| 1764 | if (ret < GNUTLS_E_SUCCESS) | 1755 | if (ret < GNUTLS_E_SUCCESS) |
| @@ -1852,7 +1843,6 @@ The alist key is the cipher name. */) | |||
| 1852 | { | 1843 | { |
| 1853 | Lisp_Object ciphers = Qnil; | 1844 | Lisp_Object ciphers = Qnil; |
| 1854 | 1845 | ||
| 1855 | #ifdef HAVE_GNUTLS3_CIPHER | ||
| 1856 | const gnutls_cipher_algorithm_t *gciphers = gnutls_cipher_list (); | 1846 | const gnutls_cipher_algorithm_t *gciphers = gnutls_cipher_list (); |
| 1857 | for (ptrdiff_t pos = 0; gciphers[pos] != 0; pos++) | 1847 | for (ptrdiff_t pos = 0; gciphers[pos] != 0; pos++) |
| 1858 | { | 1848 | { |
| @@ -1886,7 +1876,6 @@ The alist key is the cipher name. */) | |||
| 1886 | 1876 | ||
| 1887 | ciphers = Fcons (cp, ciphers); | 1877 | ciphers = Fcons (cp, ciphers); |
| 1888 | } | 1878 | } |
| 1889 | #endif | ||
| 1890 | 1879 | ||
| 1891 | return ciphers; | 1880 | return ciphers; |
| 1892 | } | 1881 | } |
| @@ -1899,7 +1888,7 @@ gnutls_symmetric_aead (bool encrypting, gnutls_cipher_algorithm_t gca, | |||
| 1899 | const char *idata, ptrdiff_t isize, | 1888 | const char *idata, ptrdiff_t isize, |
| 1900 | Lisp_Object aead_auth) | 1889 | Lisp_Object aead_auth) |
| 1901 | { | 1890 | { |
| 1902 | #ifdef HAVE_GNUTLS3_AEAD | 1891 | # ifdef HAVE_GNUTLS_AEAD |
| 1903 | 1892 | ||
| 1904 | const char *desc = encrypting ? "encrypt" : "decrypt"; | 1893 | const char *desc = encrypting ? "encrypt" : "decrypt"; |
| 1905 | Lisp_Object actual_iv = make_unibyte_string (vdata, vsize); | 1894 | Lisp_Object actual_iv = make_unibyte_string (vdata, vsize); |
| @@ -1969,10 +1958,10 @@ gnutls_symmetric_aead (bool encrypting, gnutls_cipher_algorithm_t gca, | |||
| 1969 | 1958 | ||
| 1970 | SAFE_FREE (); | 1959 | SAFE_FREE (); |
| 1971 | return list2 (output, actual_iv); | 1960 | return list2 (output, actual_iv); |
| 1972 | #else | 1961 | # else |
| 1973 | printmax_t print_gca = gca; | 1962 | printmax_t print_gca = gca; |
| 1974 | error ("GnuTLS AEAD cipher %"pMd" is invalid or not found", print_gca); | 1963 | error ("GnuTLS AEAD cipher %"pMd" is invalid or not found", print_gca); |
| 1975 | #endif | 1964 | # endif |
| 1976 | } | 1965 | } |
| 1977 | 1966 | ||
| 1978 | static Lisp_Object | 1967 | static Lisp_Object |
| @@ -2181,7 +2170,6 @@ name. */) | |||
| 2181 | (void) | 2170 | (void) |
| 2182 | { | 2171 | { |
| 2183 | Lisp_Object mac_algorithms = Qnil; | 2172 | Lisp_Object mac_algorithms = Qnil; |
| 2184 | #ifdef HAVE_GNUTLS3_HMAC | ||
| 2185 | const gnutls_mac_algorithm_t *macs = gnutls_mac_list (); | 2173 | const gnutls_mac_algorithm_t *macs = gnutls_mac_list (); |
| 2186 | for (ptrdiff_t pos = 0; macs[pos] != 0; pos++) | 2174 | for (ptrdiff_t pos = 0; macs[pos] != 0; pos++) |
| 2187 | { | 2175 | { |
| @@ -2204,7 +2192,6 @@ name. */) | |||
| 2204 | make_number (gnutls_mac_get_nonce_size (gma))); | 2192 | make_number (gnutls_mac_get_nonce_size (gma))); |
| 2205 | mac_algorithms = Fcons (mp, mac_algorithms); | 2193 | mac_algorithms = Fcons (mp, mac_algorithms); |
| 2206 | } | 2194 | } |
| 2207 | #endif | ||
| 2208 | 2195 | ||
| 2209 | return mac_algorithms; | 2196 | return mac_algorithms; |
| 2210 | } | 2197 | } |
| @@ -2218,7 +2205,6 @@ method name. */) | |||
| 2218 | (void) | 2205 | (void) |
| 2219 | { | 2206 | { |
| 2220 | Lisp_Object digest_algorithms = Qnil; | 2207 | Lisp_Object digest_algorithms = Qnil; |
| 2221 | #ifdef HAVE_GNUTLS3_DIGEST | ||
| 2222 | const gnutls_digest_algorithm_t *digests = gnutls_digest_list (); | 2208 | const gnutls_digest_algorithm_t *digests = gnutls_digest_list (); |
| 2223 | for (ptrdiff_t pos = 0; digests[pos] != 0; pos++) | 2209 | for (ptrdiff_t pos = 0; digests[pos] != 0; pos++) |
| 2224 | { | 2210 | { |
| @@ -2236,7 +2222,6 @@ method name. */) | |||
| 2236 | 2222 | ||
| 2237 | digest_algorithms = Fcons (mp, digest_algorithms); | 2223 | digest_algorithms = Fcons (mp, digest_algorithms); |
| 2238 | } | 2224 | } |
| 2239 | #endif | ||
| 2240 | 2225 | ||
| 2241 | return digest_algorithms; | 2226 | return digest_algorithms; |
| 2242 | } | 2227 | } |
| @@ -2423,25 +2408,17 @@ GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'. */) | |||
| 2423 | 2408 | ||
| 2424 | # ifdef HAVE_GNUTLS3 | 2409 | # ifdef HAVE_GNUTLS3 |
| 2425 | capabilities = Fcons (intern("gnutls3"), capabilities); | 2410 | capabilities = Fcons (intern("gnutls3"), capabilities); |
| 2426 | |||
| 2427 | # ifdef HAVE_GNUTLS3_DIGEST | ||
| 2428 | capabilities = Fcons (intern("digests"), capabilities); | 2411 | capabilities = Fcons (intern("digests"), capabilities); |
| 2429 | # endif | ||
| 2430 | |||
| 2431 | # ifdef HAVE_GNUTLS3_CIPHER | ||
| 2432 | capabilities = Fcons (intern("ciphers"), capabilities); | 2412 | capabilities = Fcons (intern("ciphers"), capabilities); |
| 2433 | 2413 | ||
| 2434 | # ifdef HAVE_GNUTLS3_AEAD | 2414 | # ifdef HAVE_GNUTLS_AEAD |
| 2435 | capabilities = Fcons (intern("AEAD-ciphers"), capabilities); | 2415 | capabilities = Fcons (intern("AEAD-ciphers"), capabilities); |
| 2436 | # endif | 2416 | # endif |
| 2437 | 2417 | ||
| 2438 | # ifdef HAVE_GNUTLS3_HMAC | ||
| 2439 | capabilities = Fcons (intern("macs"), capabilities); | 2418 | capabilities = Fcons (intern("macs"), capabilities); |
| 2440 | # endif | ||
| 2441 | # endif /* HAVE_GNUTLS3_CIPHER */ | ||
| 2442 | # endif /* HAVE_GNUTLS3 */ | 2419 | # endif /* HAVE_GNUTLS3 */ |
| 2443 | 2420 | ||
| 2444 | #ifdef WINDOWSNT | 2421 | # ifdef WINDOWSNT |
| 2445 | Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache); | 2422 | Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache); |
| 2446 | if (CONSP (found)) | 2423 | if (CONSP (found)) |
| 2447 | return XCDR (found); | 2424 | return XCDR (found); |
| @@ -2452,15 +2429,10 @@ GnuTLS AEAD ciphers : the list will contain `AEAD-ciphers'. */) | |||
| 2452 | Vlibrary_cache = Fcons (Fcons (Qgnutls, status), Vlibrary_cache); | 2429 | Vlibrary_cache = Fcons (Fcons (Qgnutls, status), Vlibrary_cache); |
| 2453 | return status; | 2430 | return status; |
| 2454 | } | 2431 | } |
| 2455 | #else /* !WINDOWSNT */ | 2432 | # endif /* WINDOWSNT */ |
| 2433 | #endif /* HAVE_GNUTLS */ | ||
| 2456 | 2434 | ||
| 2457 | return capabilities; | 2435 | return capabilities; |
| 2458 | |||
| 2459 | #endif /* WINDOWSNT */ | ||
| 2460 | |||
| 2461 | #else /* !HAVE_GNUTLS */ | ||
| 2462 | return Qnil; | ||
| 2463 | #endif /* HAVE_GNUTLS */ | ||
| 2464 | } | 2436 | } |
| 2465 | 2437 | ||
| 2466 | void | 2438 | void |
diff --git a/src/gnutls.h b/src/gnutls.h index 3ec86a8892d..9323cd1aeff 100644 --- a/src/gnutls.h +++ b/src/gnutls.h | |||
| @@ -23,8 +23,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 23 | #include <gnutls/gnutls.h> | 23 | #include <gnutls/gnutls.h> |
| 24 | #include <gnutls/x509.h> | 24 | #include <gnutls/x509.h> |
| 25 | 25 | ||
| 26 | #ifdef HAVE_GNUTLS3 | 26 | #if 0x030000 <= GNUTLS_VERSION_NUMBER |
| 27 | #include <gnutls/crypto.h> | 27 | # define HAVE_GNUTLS3 |
| 28 | # include <gnutls/crypto.h> | ||
| 28 | #endif | 29 | #endif |
| 29 | 30 | ||
| 30 | #include "lisp.h" | 31 | #include "lisp.h" |
diff --git a/src/keyboard.c b/src/keyboard.c index 804af85dad9..97069a24acc 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -10168,7 +10168,8 @@ This may include sensitive information such as passwords. */) | |||
| 10168 | file = Fexpand_file_name (file, Qnil); | 10168 | file = Fexpand_file_name (file, Qnil); |
| 10169 | encfile = ENCODE_FILE (file); | 10169 | encfile = ENCODE_FILE (file); |
| 10170 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); | 10170 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); |
| 10171 | if (fd < 0 && errno == EEXIST && unlink (SSDATA (encfile)) == 0) | 10171 | if (fd < 0 && errno == EEXIST |
| 10172 | && (unlink (SSDATA (encfile)) == 0 || errno == ENOENT)) | ||
| 10172 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); | 10173 | fd = emacs_open (SSDATA (encfile), O_WRONLY | O_CREAT | O_EXCL, 0600); |
| 10173 | dribble = fd < 0 ? 0 : fdopen (fd, "w"); | 10174 | dribble = fd < 0 ? 0 : fdopen (fd, "w"); |
| 10174 | if (dribble == 0) | 10175 | if (dribble == 0) |
diff --git a/src/lisp.h b/src/lisp.h index cffaf954b3b..4de6fc85ec1 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4298,13 +4298,15 @@ extern ptrdiff_t emacs_write (int, void const *, ptrdiff_t); | |||
| 4298 | extern ptrdiff_t emacs_write_sig (int, void const *, ptrdiff_t); | 4298 | extern ptrdiff_t emacs_write_sig (int, void const *, ptrdiff_t); |
| 4299 | extern ptrdiff_t emacs_write_quit (int, void const *, ptrdiff_t); | 4299 | extern ptrdiff_t emacs_write_quit (int, void const *, ptrdiff_t); |
| 4300 | extern void emacs_perror (char const *); | 4300 | extern void emacs_perror (char const *); |
| 4301 | extern int renameat_noreplace (int, char const *, int, char const *); | ||
| 4302 | extern int str_collate (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); | ||
| 4301 | 4303 | ||
| 4302 | extern void unlock_all_files (void); | 4304 | /* Defined in filelock.c. */ |
| 4303 | extern void lock_file (Lisp_Object); | 4305 | extern void lock_file (Lisp_Object); |
| 4304 | extern void unlock_file (Lisp_Object); | 4306 | extern void unlock_file (Lisp_Object); |
| 4307 | extern void unlock_all_files (void); | ||
| 4305 | extern void unlock_buffer (struct buffer *); | 4308 | extern void unlock_buffer (struct buffer *); |
| 4306 | extern void syms_of_filelock (void); | 4309 | extern void syms_of_filelock (void); |
| 4307 | extern int str_collate (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); | ||
| 4308 | 4310 | ||
| 4309 | /* Defined in sound.c. */ | 4311 | /* Defined in sound.c. */ |
| 4310 | extern void syms_of_sound (void); | 4312 | extern void syms_of_sound (void); |
diff --git a/src/minibuf.c b/src/minibuf.c index d4128ce01c1..010152930bc 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -497,6 +497,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 497 | Fcons (Vminibuffer_history_position, | 497 | Fcons (Vminibuffer_history_position, |
| 498 | Fcons (Vminibuffer_history_variable, | 498 | Fcons (Vminibuffer_history_variable, |
| 499 | minibuf_save_list)))))); | 499 | minibuf_save_list)))))); |
| 500 | minibuf_save_list | ||
| 501 | = Fcons (Fthis_command_keys_vector (), minibuf_save_list); | ||
| 500 | 502 | ||
| 501 | record_unwind_protect_void (read_minibuf_unwind); | 503 | record_unwind_protect_void (read_minibuf_unwind); |
| 502 | minibuf_level++; | 504 | minibuf_level++; |
| @@ -836,6 +838,11 @@ read_minibuf_unwind (void) | |||
| 836 | Fset_buffer (XWINDOW (window)->contents); | 838 | Fset_buffer (XWINDOW (window)->contents); |
| 837 | 839 | ||
| 838 | /* Restore prompt, etc, from outer minibuffer level. */ | 840 | /* Restore prompt, etc, from outer minibuffer level. */ |
| 841 | Lisp_Object key_vec = Fcar (minibuf_save_list); | ||
| 842 | eassert (VECTORP (key_vec)); | ||
| 843 | this_command_key_count = XFASTINT (Flength (key_vec)); | ||
| 844 | this_command_keys = key_vec; | ||
| 845 | minibuf_save_list = Fcdr (minibuf_save_list); | ||
| 839 | minibuf_prompt = Fcar (minibuf_save_list); | 846 | minibuf_prompt = Fcar (minibuf_save_list); |
| 840 | minibuf_save_list = Fcdr (minibuf_save_list); | 847 | minibuf_save_list = Fcdr (minibuf_save_list); |
| 841 | minibuf_prompt_width = XFASTINT (Fcar (minibuf_save_list)); | 848 | minibuf_prompt_width = XFASTINT (Fcar (minibuf_save_list)); |
diff --git a/src/regex.c b/src/regex.c index fb48765c96c..0dbb47309e4 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -1942,7 +1942,7 @@ struct range_table_work_area | |||
| 1942 | returned. If name is not a valid character class name zero, or RECC_ERROR, | 1942 | returned. If name is not a valid character class name zero, or RECC_ERROR, |
| 1943 | is returned. | 1943 | is returned. |
| 1944 | 1944 | ||
| 1945 | Otherwise, if *strp doesn’t begin with "[:name:]", -1 is returned. | 1945 | Otherwise, if *strp doesn't begin with "[:name:]", -1 is returned. |
| 1946 | 1946 | ||
| 1947 | The function can be used on ASCII and multibyte (UTF-8-encoded) strings. | 1947 | The function can be used on ASCII and multibyte (UTF-8-encoded) strings. |
| 1948 | */ | 1948 | */ |
| @@ -1954,8 +1954,8 @@ re_wctype_parse (const unsigned char **strp, unsigned limit) | |||
| 1954 | if (limit < 4 || beg[0] != '[' || beg[1] != ':') | 1954 | if (limit < 4 || beg[0] != '[' || beg[1] != ':') |
| 1955 | return -1; | 1955 | return -1; |
| 1956 | 1956 | ||
| 1957 | beg += 2; /* skip opening ‘[:’ */ | 1957 | beg += 2; /* skip opening "[:" */ |
| 1958 | limit -= 3; /* opening ‘[:’ and half of closing ‘:]’; --limit handles rest */ | 1958 | limit -= 3; /* opening "[:" and half of closing ":]"; --limit handles rest */ |
| 1959 | for (it = beg; it[0] != ':' || it[1] != ']'; ++it) | 1959 | for (it = beg; it[0] != ':' || it[1] != ']'; ++it) |
| 1960 | if (!--limit) | 1960 | if (!--limit) |
| 1961 | return -1; | 1961 | return -1; |
| @@ -1985,7 +1985,7 @@ re_wctype_parse (const unsigned char **strp, unsigned limit) | |||
| 1985 | 2 [:cntrl:] | 1985 | 2 [:cntrl:] |
| 1986 | 1 [:ff:] | 1986 | 1 [:ff:] |
| 1987 | 1987 | ||
| 1988 | If you update this list, consider also updating chain of or’ed conditions | 1988 | If you update this list, consider also updating chain of or'ed conditions |
| 1989 | in execute_charset function. | 1989 | in execute_charset function. |
| 1990 | */ | 1990 | */ |
| 1991 | 1991 | ||
diff --git a/src/regex.h b/src/regex.h index 1d439de259c..5e3a79763ec 100644 --- a/src/regex.h +++ b/src/regex.h | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #define _REGEX_H 1 | 21 | #define _REGEX_H 1 |
| 22 | 22 | ||
| 23 | #if defined emacs && (defined _REGEX_RE_COMP || defined _LIBC) | 23 | #if defined emacs && (defined _REGEX_RE_COMP || defined _LIBC) |
| 24 | /* We’re not defining re_set_syntax and using a different prototype of | 24 | /* We're not defining re_set_syntax and using a different prototype of |
| 25 | re_compile_pattern when building Emacs so fail compilation early with | 25 | re_compile_pattern when building Emacs so fail compilation early with |
| 26 | a (somewhat helpful) error message when conflict is detected. */ | 26 | a (somewhat helpful) error message when conflict is detected. */ |
| 27 | # error "_REGEX_RE_COMP nor _LIBC can be defined if emacs is defined." | 27 | # error "_REGEX_RE_COMP nor _LIBC can be defined if emacs is defined." |
diff --git a/src/sysdep.c b/src/sysdep.c index db99f53299c..9eb733221e4 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -37,6 +37,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 37 | #include "sysselect.h" | 37 | #include "sysselect.h" |
| 38 | #include "blockinput.h" | 38 | #include "blockinput.h" |
| 39 | 39 | ||
| 40 | #ifdef HAVE_LINUX_FS_H | ||
| 41 | # include <linux/fs.h> | ||
| 42 | # include <sys/syscall.h> | ||
| 43 | #endif | ||
| 44 | |||
| 40 | #if defined DARWIN_OS || defined __FreeBSD__ | 45 | #if defined DARWIN_OS || defined __FreeBSD__ |
| 41 | # include <sys/sysctl.h> | 46 | # include <sys/sysctl.h> |
| 42 | #endif | 47 | #endif |
| @@ -2678,6 +2683,21 @@ set_file_times (int fd, const char *filename, | |||
| 2678 | timespec[1] = mtime; | 2683 | timespec[1] = mtime; |
| 2679 | return fdutimens (fd, filename, timespec); | 2684 | return fdutimens (fd, filename, timespec); |
| 2680 | } | 2685 | } |
| 2686 | |||
| 2687 | /* Rename directory SRCFD's entry SRC to directory DSTFD's entry DST. | ||
| 2688 | This is like renameat except that it fails if DST already exists, | ||
| 2689 | or if this operation is not supported atomically. Return 0 if | ||
| 2690 | successful, -1 (setting errno) otherwise. */ | ||
| 2691 | int | ||
| 2692 | renameat_noreplace (int srcfd, char const *src, int dstfd, char const *dst) | ||
| 2693 | { | ||
| 2694 | #if defined SYS_renameat2 && defined RENAME_NOREPLACE | ||
| 2695 | return syscall (SYS_renameat2, srcfd, src, dstfd, dst, RENAME_NOREPLACE); | ||
| 2696 | #else | ||
| 2697 | errno = ENOSYS; | ||
| 2698 | return -1; | ||
| 2699 | #endif | ||
| 2700 | } | ||
| 2681 | 2701 | ||
| 2682 | /* Like strsignal, except async-signal-safe, and this function typically | 2702 | /* Like strsignal, except async-signal-safe, and this function typically |
| 2683 | returns a string in the C locale rather than the current locale. */ | 2703 | returns a string in the C locale rather than the current locale. */ |