Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs into feature/pgtk

This commit is contained in:
Yuuki Harano 2021-11-11 00:39:53 +09:00
commit 4dd1f56f29
1764 changed files with 89018 additions and 41540 deletions

View file

@ -80,9 +80,6 @@ char *w32_getenv (const char *);
#include <sys/stat.h>
#include <unistd.h>
#ifndef WINDOWSNT
# include <acl.h>
#endif
#include <filename.h>
#include <intprops.h>
#include <min-max.h>
@ -94,10 +91,6 @@ char *w32_getenv (const char *);
# pragma GCC diagnostic ignored "-Wformat-truncation=2"
#endif
#if !defined O_PATH && !defined WINDOWSNT
# define O_PATH O_SEARCH
#endif
/* Name used to invoke this program. */
static char const *progname;
@ -123,6 +116,9 @@ static bool eval;
/* True means open a new frame. --create-frame etc. */
static bool create_frame;
/* True means reuse a frame if it already exists. */
static bool reuse_frame;
/* The display on which Emacs should work. --display. */
static char const *display;
@ -172,6 +168,7 @@ static struct option const longopts[] =
{ "tty", no_argument, NULL, 't' },
{ "nw", no_argument, NULL, 't' },
{ "create-frame", no_argument, NULL, 'c' },
{ "reuse-frame", no_argument, NULL, 'r' },
{ "alternate-editor", required_argument, NULL, 'a' },
{ "frame-parameters", required_argument, NULL, 'F' },
#ifdef SOCKETS_IN_FILE_SYSTEM
@ -558,6 +555,11 @@ decode_options (int argc, char **argv)
create_frame = true;
break;
case 'r':
create_frame = true;
reuse_frame = true;
break;
case 'p':
parent_id = optarg;
create_frame = true;
@ -659,6 +661,8 @@ The following OPTIONS are accepted:\n\
-nw, -t, --tty Open a new Emacs frame on the current terminal\n\
-c, --create-frame Create a new frame instead of trying to\n\
use the current Emacs frame\n\
-r, --reuse-frame Create a new frame if none exists, otherwise\n\
use the current Emacs frame\n\
", "\
-F ALIST, --frame-parameters=ALIST\n\
Set the parameters of a new frame\n\
@ -1140,6 +1144,12 @@ process_grouping (void)
#ifdef SOCKETS_IN_FILE_SYSTEM
# include <acl.h>
# ifndef O_PATH
# define O_PATH O_SEARCH
# endif
/* A local socket address. The union avoids the need to cast. */
union local_sockaddr
{
@ -1406,10 +1416,8 @@ local_sockname (int s, char sockname[socknamesize], int tmpdirlen,
/* Put the full address name into the buffer, since the caller might
need it for diagnostics. But don't overrun the buffer. */
uintmax_t uidmax = uid;
int emacsdirlen;
int suffixlen = snprintf (sockname + tmpdirlen, socknamesize - tmpdirlen,
"/emacs%"PRIuMAX"%n/%s", uidmax, &emacsdirlen,
server_name);
"/emacs%"PRIuMAX"/%s", uidmax, server_name);
if (! (0 <= suffixlen && suffixlen < socknamesize - tmpdirlen))
return ENAMETOOLONG;
@ -1417,7 +1425,8 @@ local_sockname (int s, char sockname[socknamesize], int tmpdirlen,
this user's directory and does not let others write to it; this
fends off some symlink attacks. To avoid races, keep the parent
directory open while checking. */
char *emacsdirend = sockname + tmpdirlen + emacsdirlen;
char *emacsdirend = sockname + tmpdirlen + suffixlen -
strlen(server_name) - 1;
*emacsdirend = '\0';
int dir = openat (AT_FDCWD, sockname,
O_PATH | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC);
@ -1948,7 +1957,7 @@ main (int argc, char **argv)
if (nowait)
send_to_emacs (emacs_socket, "-nowait ");
if (!create_frame)
if (!create_frame || reuse_frame)
send_to_emacs (emacs_socket, "-current-frame ");
if (display)