1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-07 15:00:34 -08:00

*** empty log message ***

This commit is contained in:
Jim Blandy 1992-01-14 08:05:08 +00:00
parent 2798dedf7c
commit efb859b44a
5 changed files with 201 additions and 235 deletions

View file

@ -1,4 +1,4 @@
/* Client process that communicates with GNU Emacs acting as server.`
/* Client process that communicates with GNU Emacs acting as server.
Copyright (C) 1986, 1987 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@ -49,13 +49,10 @@ main (argc, argv)
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/stat.h>
#include <stdio.h>
#include <errno.h>
#ifndef SERVER_HOME_DIR
#include <sys/stat.h>
#endif
extern int sys_nerr;
extern char *sys_errlist[];
extern int errno;
@ -70,9 +67,6 @@ main (argc, argv)
struct sockaddr_un server;
char *homedir, *cwd, *str;
char string[BUFSIZ];
#ifndef SERVER_HOME_DIR
struct stat statbfr;
#endif
char *getenv (), *getwd ();
int geteuid ();
@ -95,19 +89,23 @@ main (argc, argv)
}
server.sun_family = AF_UNIX;
#ifndef SERVER_HOME_DIR
gethostname (system_name, sizeof (system_name));
sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name);
{
struct stat statbfr;
if (stat (server.sun_path, &statbfr) == -1)
{
perror ("stat");
exit (1);
}
if (statbfr.st_uid != geteuid())
{
fprintf (stderr, "Illegal socket owner\n");
exit (1);
}
gethostname (system_name, sizeof (system_name));
sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name);
if (stat (server.sun_path, &statbfr) == -1)
{
perror ("stat");
exit (1);
}
if (statbfr.st_uid != geteuid())
{
fprintf (stderr, "Illegal socket owner\n");
exit (1);
}
}
#else
if ((homedir = getenv ("HOME")) == NULL)
{