diff options
| author | Yuuki Harano | 2021-11-11 00:39:53 +0900 |
|---|---|---|
| committer | Yuuki Harano | 2021-11-11 00:39:53 +0900 |
| commit | 4dd1f56f29fc598a8339a345c2f8945250600602 (patch) | |
| tree | af341efedffe027e533b1bcc0dbf270532e48285 /lib-src | |
| parent | 4c49ec7f865bdad1629d2f125f71f4e506b258f2 (diff) | |
| parent | 810fa21d26453f898de9747ece7205dfe6de9d08 (diff) | |
| download | emacs-4dd1f56f29fc598a8339a345c2f8945250600602.tar.gz emacs-4dd1f56f29fc598a8339a345c2f8945250600602.zip | |
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs into feature/pgtk
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/Makefile.in | 1 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 33 | ||||
| -rw-r--r-- | lib-src/etags.c | 2 | ||||
| -rw-r--r-- | lib-src/ntlib.c | 6 | ||||
| -rw-r--r-- | lib-src/seccomp-filter.c | 11 |
5 files changed, 34 insertions, 19 deletions
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 7af89eb380d..e6cda733679 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in | |||
| @@ -52,6 +52,7 @@ top_builddir = @top_builddir@ | |||
| 52 | # Location to install Emacs.app under GNUstep / macOS. | 52 | # Location to install Emacs.app under GNUstep / macOS. |
| 53 | # Later values may use this. | 53 | # Later values may use this. |
| 54 | ns_appbindir=@ns_appbindir@ | 54 | ns_appbindir=@ns_appbindir@ |
| 55 | ns_applibexecdir=@ns_applibexecdir@ | ||
| 55 | 56 | ||
| 56 | # The default location for installation. Everything is placed in | 57 | # The default location for installation. Everything is placed in |
| 57 | # subdirectories of this directory. The default values for many of | 58 | # subdirectories of this directory. The default values for many of |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 8fa571fd4ef..1f3e72f81db 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -80,9 +80,6 @@ char *w32_getenv (const char *); | |||
| 80 | #include <sys/stat.h> | 80 | #include <sys/stat.h> |
| 81 | #include <unistd.h> | 81 | #include <unistd.h> |
| 82 | 82 | ||
| 83 | #ifndef WINDOWSNT | ||
| 84 | # include <acl.h> | ||
| 85 | #endif | ||
| 86 | #include <filename.h> | 83 | #include <filename.h> |
| 87 | #include <intprops.h> | 84 | #include <intprops.h> |
| 88 | #include <min-max.h> | 85 | #include <min-max.h> |
| @@ -94,10 +91,6 @@ char *w32_getenv (const char *); | |||
| 94 | # pragma GCC diagnostic ignored "-Wformat-truncation=2" | 91 | # pragma GCC diagnostic ignored "-Wformat-truncation=2" |
| 95 | #endif | 92 | #endif |
| 96 | 93 | ||
| 97 | #if !defined O_PATH && !defined WINDOWSNT | ||
| 98 | # define O_PATH O_SEARCH | ||
| 99 | #endif | ||
| 100 | |||
| 101 | 94 | ||
| 102 | /* Name used to invoke this program. */ | 95 | /* Name used to invoke this program. */ |
| 103 | static char const *progname; | 96 | static char const *progname; |
| @@ -123,6 +116,9 @@ static bool eval; | |||
| 123 | /* True means open a new frame. --create-frame etc. */ | 116 | /* True means open a new frame. --create-frame etc. */ |
| 124 | static bool create_frame; | 117 | static bool create_frame; |
| 125 | 118 | ||
| 119 | /* True means reuse a frame if it already exists. */ | ||
| 120 | static bool reuse_frame; | ||
| 121 | |||
| 126 | /* The display on which Emacs should work. --display. */ | 122 | /* The display on which Emacs should work. --display. */ |
| 127 | static char const *display; | 123 | static char const *display; |
| 128 | 124 | ||
| @@ -172,6 +168,7 @@ static struct option const longopts[] = | |||
| 172 | { "tty", no_argument, NULL, 't' }, | 168 | { "tty", no_argument, NULL, 't' }, |
| 173 | { "nw", no_argument, NULL, 't' }, | 169 | { "nw", no_argument, NULL, 't' }, |
| 174 | { "create-frame", no_argument, NULL, 'c' }, | 170 | { "create-frame", no_argument, NULL, 'c' }, |
| 171 | { "reuse-frame", no_argument, NULL, 'r' }, | ||
| 175 | { "alternate-editor", required_argument, NULL, 'a' }, | 172 | { "alternate-editor", required_argument, NULL, 'a' }, |
| 176 | { "frame-parameters", required_argument, NULL, 'F' }, | 173 | { "frame-parameters", required_argument, NULL, 'F' }, |
| 177 | #ifdef SOCKETS_IN_FILE_SYSTEM | 174 | #ifdef SOCKETS_IN_FILE_SYSTEM |
| @@ -558,6 +555,11 @@ decode_options (int argc, char **argv) | |||
| 558 | create_frame = true; | 555 | create_frame = true; |
| 559 | break; | 556 | break; |
| 560 | 557 | ||
| 558 | case 'r': | ||
| 559 | create_frame = true; | ||
| 560 | reuse_frame = true; | ||
| 561 | break; | ||
| 562 | |||
| 561 | case 'p': | 563 | case 'p': |
| 562 | parent_id = optarg; | 564 | parent_id = optarg; |
| 563 | create_frame = true; | 565 | create_frame = true; |
| @@ -659,6 +661,8 @@ The following OPTIONS are accepted:\n\ | |||
| 659 | -nw, -t, --tty Open a new Emacs frame on the current terminal\n\ | 661 | -nw, -t, --tty Open a new Emacs frame on the current terminal\n\ |
| 660 | -c, --create-frame Create a new frame instead of trying to\n\ | 662 | -c, --create-frame Create a new frame instead of trying to\n\ |
| 661 | use the current Emacs frame\n\ | 663 | use the current Emacs frame\n\ |
| 664 | -r, --reuse-frame Create a new frame if none exists, otherwise\n\ | ||
| 665 | use the current Emacs frame\n\ | ||
| 662 | ", "\ | 666 | ", "\ |
| 663 | -F ALIST, --frame-parameters=ALIST\n\ | 667 | -F ALIST, --frame-parameters=ALIST\n\ |
| 664 | Set the parameters of a new frame\n\ | 668 | Set the parameters of a new frame\n\ |
| @@ -1140,6 +1144,12 @@ process_grouping (void) | |||
| 1140 | 1144 | ||
| 1141 | #ifdef SOCKETS_IN_FILE_SYSTEM | 1145 | #ifdef SOCKETS_IN_FILE_SYSTEM |
| 1142 | 1146 | ||
| 1147 | # include <acl.h> | ||
| 1148 | |||
| 1149 | # ifndef O_PATH | ||
| 1150 | # define O_PATH O_SEARCH | ||
| 1151 | # endif | ||
| 1152 | |||
| 1143 | /* A local socket address. The union avoids the need to cast. */ | 1153 | /* A local socket address. The union avoids the need to cast. */ |
| 1144 | union local_sockaddr | 1154 | union local_sockaddr |
| 1145 | { | 1155 | { |
| @@ -1406,10 +1416,8 @@ local_sockname (int s, char sockname[socknamesize], int tmpdirlen, | |||
| 1406 | /* Put the full address name into the buffer, since the caller might | 1416 | /* Put the full address name into the buffer, since the caller might |
| 1407 | need it for diagnostics. But don't overrun the buffer. */ | 1417 | need it for diagnostics. But don't overrun the buffer. */ |
| 1408 | uintmax_t uidmax = uid; | 1418 | uintmax_t uidmax = uid; |
| 1409 | int emacsdirlen; | ||
| 1410 | int suffixlen = snprintf (sockname + tmpdirlen, socknamesize - tmpdirlen, | 1419 | int suffixlen = snprintf (sockname + tmpdirlen, socknamesize - tmpdirlen, |
| 1411 | "/emacs%"PRIuMAX"%n/%s", uidmax, &emacsdirlen, | 1420 | "/emacs%"PRIuMAX"/%s", uidmax, server_name); |
| 1412 | server_name); | ||
| 1413 | if (! (0 <= suffixlen && suffixlen < socknamesize - tmpdirlen)) | 1421 | if (! (0 <= suffixlen && suffixlen < socknamesize - tmpdirlen)) |
| 1414 | return ENAMETOOLONG; | 1422 | return ENAMETOOLONG; |
| 1415 | 1423 | ||
| @@ -1417,7 +1425,8 @@ local_sockname (int s, char sockname[socknamesize], int tmpdirlen, | |||
| 1417 | this user's directory and does not let others write to it; this | 1425 | this user's directory and does not let others write to it; this |
| 1418 | fends off some symlink attacks. To avoid races, keep the parent | 1426 | fends off some symlink attacks. To avoid races, keep the parent |
| 1419 | directory open while checking. */ | 1427 | directory open while checking. */ |
| 1420 | char *emacsdirend = sockname + tmpdirlen + emacsdirlen; | 1428 | char *emacsdirend = sockname + tmpdirlen + suffixlen - |
| 1429 | strlen(server_name) - 1; | ||
| 1421 | *emacsdirend = '\0'; | 1430 | *emacsdirend = '\0'; |
| 1422 | int dir = openat (AT_FDCWD, sockname, | 1431 | int dir = openat (AT_FDCWD, sockname, |
| 1423 | O_PATH | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC); | 1432 | O_PATH | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC); |
| @@ -1948,7 +1957,7 @@ main (int argc, char **argv) | |||
| 1948 | if (nowait) | 1957 | if (nowait) |
| 1949 | send_to_emacs (emacs_socket, "-nowait "); | 1958 | send_to_emacs (emacs_socket, "-nowait "); |
| 1950 | 1959 | ||
| 1951 | if (!create_frame) | 1960 | if (!create_frame || reuse_frame) |
| 1952 | send_to_emacs (emacs_socket, "-current-frame "); | 1961 | send_to_emacs (emacs_socket, "-current-frame "); |
| 1953 | 1962 | ||
| 1954 | if (display) | 1963 | if (display) |
diff --git a/lib-src/etags.c b/lib-src/etags.c index 88b49f803e9..bd4d4fcf53a 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -6259,7 +6259,7 @@ test_objc_is_mercury (char *this_file, language **lang) | |||
| 6259 | } | 6259 | } |
| 6260 | } | 6260 | } |
| 6261 | 6261 | ||
| 6262 | /* Fallback heuristic test. Not failsafe but errless in pratice. */ | 6262 | /* Fallback heuristic test. Not failsafe but errless in practice. */ |
| 6263 | ratio = ((float) rule_signs + percentage_signs + mercury_dots) / lines; | 6263 | ratio = ((float) rule_signs + percentage_signs + mercury_dots) / lines; |
| 6264 | 6264 | ||
| 6265 | out: | 6265 | out: |
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index bcbc0064318..c8bcf742fea 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c | |||
| @@ -20,6 +20,9 @@ GNU General Public License for more details. | |||
| 20 | You should have received a copy of the GNU General Public License | 20 | You should have received a copy of the GNU General Public License |
| 21 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | 21 | along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ |
| 22 | 22 | ||
| 23 | #define DEFER_MS_W32_H | ||
| 24 | #include <config.h> | ||
| 25 | |||
| 23 | #include <windows.h> | 26 | #include <windows.h> |
| 24 | #include <stdlib.h> | 27 | #include <stdlib.h> |
| 25 | #include <stdio.h> | 28 | #include <stdio.h> |
| @@ -287,9 +290,6 @@ is_exec (const char * name) | |||
| 287 | stricmp (p, ".cmd") == 0)); | 290 | stricmp (p, ".cmd") == 0)); |
| 288 | } | 291 | } |
| 289 | 292 | ||
| 290 | /* FIXME? This is in configure.ac now - is this still needed? */ | ||
| 291 | #define IS_DIRECTORY_SEP(x) ((x) == '/' || (x) == '\\') | ||
| 292 | |||
| 293 | /* We need stat/fsfat below because nt/inc/sys/stat.h defines struct | 293 | /* We need stat/fsfat below because nt/inc/sys/stat.h defines struct |
| 294 | stat that is incompatible with the MS run-time libraries. */ | 294 | stat that is incompatible with the MS run-time libraries. */ |
| 295 | int | 295 | int |
diff --git a/lib-src/seccomp-filter.c b/lib-src/seccomp-filter.c index dc568e035b5..e7496053a86 100644 --- a/lib-src/seccomp-filter.c +++ b/lib-src/seccomp-filter.c | |||
| @@ -131,9 +131,12 @@ export_filter (const char *file, | |||
| 131 | int (*function) (const scmp_filter_ctx, int), | 131 | int (*function) (const scmp_filter_ctx, int), |
| 132 | const char *name) | 132 | const char *name) |
| 133 | { | 133 | { |
| 134 | int fd = TEMP_FAILURE_RETRY ( | 134 | int fd; |
| 135 | open (file, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_CLOEXEC, | 135 | do |
| 136 | 0644)); | 136 | fd = open (file, |
| 137 | O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_CLOEXEC, | ||
| 138 | 0644); | ||
| 139 | while (fd < 0 && errno == EINTR); | ||
| 137 | if (fd < 0) | 140 | if (fd < 0) |
| 138 | fail (errno, "open %s", file); | 141 | fail (errno, "open %s", file); |
| 139 | int status = function (ctx, fd); | 142 | int status = function (ctx, fd); |
| @@ -348,6 +351,8 @@ main (int argc, char **argv) | |||
| 348 | calls at startup time to set up thread-local storage. */ | 351 | calls at startup time to set up thread-local storage. */ |
| 349 | RULE (SCMP_ACT_ALLOW, SCMP_SYS (execve)); | 352 | RULE (SCMP_ACT_ALLOW, SCMP_SYS (execve)); |
| 350 | RULE (SCMP_ACT_ALLOW, SCMP_SYS (set_tid_address)); | 353 | RULE (SCMP_ACT_ALLOW, SCMP_SYS (set_tid_address)); |
| 354 | RULE (SCMP_ACT_ERRNO (EINVAL), SCMP_SYS (prctl), | ||
| 355 | SCMP_A0_32 (SCMP_CMP_EQ, PR_CAPBSET_READ)); | ||
| 351 | RULE (SCMP_ACT_ALLOW, SCMP_SYS (arch_prctl), | 356 | RULE (SCMP_ACT_ALLOW, SCMP_SYS (arch_prctl), |
| 352 | SCMP_A0_32 (SCMP_CMP_EQ, ARCH_SET_FS)); | 357 | SCMP_A0_32 (SCMP_CMP_EQ, ARCH_SET_FS)); |
| 353 | RULE (SCMP_ACT_ERRNO (EINVAL), SCMP_SYS (arch_prctl), | 358 | RULE (SCMP_ACT_ERRNO (EINVAL), SCMP_SYS (arch_prctl), |