Commit 77acdba9 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

raise version to 2.2.3.1

Thu Jul 05 03:29:01 2001  George Lebl <jirka@5z.com>

	* configure.in: raise version to 2.2.3.1

	* gdm.spec.in: do a "soft restart" in %post

	* gui/gdmchooser.c, gui/gdmlogin.c: warning fixes

	* daemon/misc.h, daemon/slave.c, daemon/xdmcp.c, daemon/choose.c,
	  daemon/display.c, daemon/gdm.c,saemon/server.c: fix printf style
	  warnings

	* daemon/choose.[ch], display/gdm.[ch], daemon/slave.c: change the
	  fifo protocol to be text based so that we can also control from
	  scripts like the .spec file.  Also store all the different pids
	  in the daemon so that we can whack all the different processes
	  the slave starts if it crashes.  Also add a soft restart opcode.
parent a277ba17
Thu Jul 05 03:29:01 2001 George Lebl <jirka@5z.com>
* configure.in: raise version to 2.2.3.1
* gdm.spec.in: do a "soft restart" in %post
* gui/gdmchooser.c, gui/gdmlogin.c: warning fixes
* daemon/misc.h, daemon/slave.c, daemon/xdmcp.c, daemon/choose.c,
daemon/display.c, daemon/gdm.c,saemon/server.c: fix printf style
warnings
* daemon/choose.[ch], display/gdm.[ch], daemon/slave.c: change the
fifo protocol to be text based so that we can also control from
scripts like the .spec file. Also store all the different pids
in the daemon so that we can whack all the different processes
the slave starts if it crashes. Also add a soft restart opcode.
Wed Jul 04 20:58:31 2001 George Lebl <jirka@5z.com>
* gdm-safe-restart.in, Makefile.am, configure.in, daemon/choose.[ch],
......
......@@ -17,7 +17,4 @@ xsri like logo functionality
the photosetup proggie should be put into some sort of crapplet and there
should be other settings in the crapplet as well.
Version /var/run/gdm.version, and check this on gdm-safe-restart, and
do safe restart in spec file
Make sure that greeter whacks all on SIGPIPE (X connection fail)
......@@ -7,7 +7,7 @@ dnl
AM_PROG_XML_I18N_TOOLS
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(gdm,2.2.3)
AM_INIT_AUTOMAKE(gdm,2.2.3.1)
AM_MAINTAINER_MODE
AM_ACLOCAL_INCLUDE(macros)
......
......@@ -39,6 +39,7 @@
#include <fcntl.h>
#include "gdm.h"
#include "misc.h"
#include "choose.h"
static const gchar RCSid[]="$Id$";
......@@ -50,8 +51,6 @@ static GSList *indirect = NULL;
extern gint GdmMaxIndirect; /* Maximum pending indirects, i.e. simultaneous choosing sessions */
extern gint GdmMaxIndirectWait; /* Maximum age before a pending session is removed from the list */
extern void gdm_debug (gchar *, ...);
static guint indirect_id = 1;
static gboolean
......@@ -80,23 +79,38 @@ remove_oldest_pending (void)
}
gboolean
gdm_choose_data (void *uncast_data, size_t len)
gdm_choose_data (const char *data)
{
GdmChooseData data;
int id;
struct in_addr addr;
GSList *li;
char *msg = g_strdup (data);
char *p;
if (len != sizeof (data)) {
p = strtok (msg, " ");
if (p == NULL || strcmp (GDM_SOP_CHOSEN, p) != 0) {
g_free (msg);
return FALSE;
}
memcpy (&data, uncast_data, len);
p = strtok (NULL, " ");
if (p == NULL || sscanf (p, "%d", &id) != 1) {
g_free (msg);
return FALSE;
}
p = strtok (NULL, " ");
if (p == NULL || inet_aton (p, &addr) == 0) {
g_free (msg);
return FALSE;
}
gdm_debug ("gdm_choose_data: got indirect id: %d address: %s",
data.id, inet_ntoa (data.addr));
id, inet_ntoa (addr));
for (li = indirect; li != NULL; li = li->next) {
GdmIndirectDisplay *idisp = li->data;
if (idisp->id == data.id) {
if (idisp->id == id) {
/* whack the oldest if more then allowed */
while (ipending >= GdmMaxIndirect &&
remove_oldest_pending ())
......@@ -105,7 +119,7 @@ gdm_choose_data (void *uncast_data, size_t len)
idisp->acctime = time (NULL);
g_free (idisp->chosen_host);
idisp->chosen_host = g_new (struct in_addr, 1);
memcpy (idisp->chosen_host, &(data.addr),
memcpy (idisp->chosen_host, &addr,
sizeof (struct in_addr));
/* Now this display is pending */
......@@ -217,7 +231,7 @@ gdm_choose_indirect_dispose (GdmIndirectDisplay *id)
ipending--;
id->acctime = 0;
gdm_debug ("gdm_choose_indirect_dispose: Disposing %d",
gdm_debug ("gdm_choose_indirect_dispose: Disposing %s",
inet_ntoa (id->dsp_sa->sin_addr));
g_free (id->dsp_sa);
......
......@@ -21,9 +21,6 @@
#include "gdm.h"
#include <netinet/in.h>
#include <arpa/inet.h>
GdmIndirectDisplay * gdm_choose_indirect_alloc (struct sockaddr_in *clnt_sa);
GdmIndirectDisplay * gdm_choose_indirect_lookup (struct sockaddr_in *clnt_sa);
void gdm_choose_indirect_dispose (GdmIndirectDisplay *id);
......@@ -31,14 +28,7 @@ void gdm_choose_indirect_dispose (GdmIndirectDisplay *id);
/* dispose of indirect display of id, if no host is set */
void gdm_choose_indirect_dispose_empty_id (guint id);
typedef struct _GdmChooseData GdmChooseData;
struct _GdmChooseData {
int id;
struct in_addr addr;
};
gboolean gdm_choose_data (void *uncast_data,
size_t len);
gboolean gdm_choose_data (const char *data);
#endif /* CHOOSE_H */
......
......@@ -101,8 +101,8 @@ gdm_display_check_loop (GdmDisplay *disp)
*/
if (since_last < 8)
{
gdm_debug ("Will sleep %d seconds before next X server restart attempt",
8 - since_last);
gdm_debug ("Will sleep %ld seconds before next X server restart attempt",
(long)(8 - since_last));
now = time (NULL) + 8 - since_last;
disp->sleep_before_run = 8 - since_last;
}
......
......@@ -372,7 +372,7 @@ gdm_config_parse (void)
*stemp = '\0';
if (access (gtemp, X_OK))
gdm_error ("gdm_config_parse: Greeter not found or can't be executed by the gdm user", gtemp);
gdm_error (_("%s: Greeter not found or can't be executed by the gdm user"), "gdm_config_parse");
}
g_free (gtemp);
......@@ -386,7 +386,7 @@ gdm_config_parse (void)
*stemp = '\0';
if (access (gtemp, X_OK))
gdm_error ("gdm_config_parse: Chooser not found or it can't be executed by the gdm user", gtemp);
gdm_error (_("%s: Chooser not found or it can't be executed by the gdm user"), "gdm_config_parse");
}
g_free (gtemp);
......@@ -705,7 +705,8 @@ gdm_cleanup_children (void)
crashed = TRUE;
}
gdm_debug ("gdm_cleanup_children: child %d returned %d", pid, status);
gdm_debug ("gdm_cleanup_children: child %d returned %d%s", pid, status,
crashed ? " (child crashed)" : "");
if (pid < 1)
return;
......@@ -717,19 +718,37 @@ gdm_cleanup_children (void)
return;
if (crashed) {
gdm_debug ("gdm_cleanup_children: Slave crashed, killing it's "
"children");
if (d->sesspid > 0) {
if (kill (d->sesspid, SIGTERM) == 0)
waitpid (d->sesspid, NULL, 0);
d->sesspid = 0;
}
if (d->greetpid > 0) {
if (kill (d->greetpid, SIGTERM) == 0)
waitpid (d->greetpid, NULL, 0);
d->greetpid = 0;
}
if (d->chooserpid > 0) {
if (kill (d->chooserpid, SIGTERM) == 0)
waitpid (d->chooserpid, NULL, 0);
d->chooserpid = 0;
}
if (d->servpid > 0) {
if (kill (d->servpid, SIGTERM) == 0)
waitpid (d->servpid, NULL, 0);
/* just for paranoia's sake, yes sleeping in the
* daemon is bad but this is an exceptional
* situation and not normal occurance. */
sleep (3);
d->servpid = 0;
}
}
/* null all these, they are not valid most definately */
d->servpid = 0;
d->sesspid = 0;
d->greetpid = 0;
d->chooserpid = 0;
/* definately not logged in now */
d->logged_in = FALSE;
......@@ -1268,81 +1287,144 @@ gdm_quit (void)
g_main_quit (main_loop);
}
static void
handle_message (const char *msg)
{
gdm_debug ("Handeling message: '%s'", msg);
if (strncmp (msg, GDM_SOP_CHOSEN " ",
strlen (GDM_SOP_CHOSEN " ")) == 0) {
gdm_choose_data (msg);
} else if (strncmp (msg, GDM_SOP_XPID " ",
strlen (GDM_SOP_XPID " ")) == 0) {
GdmDisplay *d;
long slave_pid, pid;
if (sscanf (msg, GDM_SOP_XPID " %ld %ld", &slave_pid, &pid)
!= 2)
return;
/* Find out who this slave belongs to */
d = gdm_display_lookup (slave_pid);
if (d != NULL) {
d->servpid = pid;
gdm_debug ("Got XPID == %ld", (long)pid);
/* send ack */
kill (slave_pid, SIGUSR2);
}
} else if (strncmp (msg, GDM_SOP_SESSPID " ",
strlen (GDM_SOP_SESSPID " ")) == 0) {
GdmDisplay *d;
long slave_pid, pid;
if (sscanf (msg, GDM_SOP_SESSPID " %ld %ld", &slave_pid, &pid)
!= 2)
return;
/* Find out who this slave belongs to */
d = gdm_display_lookup (slave_pid);
if (d != NULL) {
d->sesspid = pid;
gdm_debug ("Got SESSPID == %ld", (long)pid);
/* send ack */
kill (slave_pid, SIGUSR2);
}
} else if (strncmp (msg, GDM_SOP_GREETPID " ",
strlen (GDM_SOP_GREETPID " ")) == 0) {
GdmDisplay *d;
long slave_pid, pid;
if (sscanf (msg, GDM_SOP_GREETPID " %ld %ld", &slave_pid, &pid)
!= 2)
return;
/* Find out who this slave belongs to */
d = gdm_display_lookup (slave_pid);
if (d != NULL) {
d->greetpid = pid;
gdm_debug ("Got GREETPID == %ld", (long)pid);
/* send ack */
kill (slave_pid, SIGUSR2);
}
} else if (strncmp (msg, GDM_SOP_CHOOSERPID " ",
strlen (GDM_SOP_CHOOSERPID " ")) == 0) {
GdmDisplay *d;
long slave_pid, pid;
if (sscanf (msg, GDM_SOP_CHOOSERPID " %ld %ld",
&slave_pid, &pid) != 2)
return;
/* Find out who this slave belongs to */
d = gdm_display_lookup (slave_pid);
if (d != NULL) {
d->chooserpid = pid;
gdm_debug ("Got CHOOSERPID == %ld", (long)pid);
/* send ack */
kill (slave_pid, SIGUSR2);
}
} else if (strncmp (msg, GDM_SOP_LOGGED_IN " ",
strlen (GDM_SOP_LOGGED_IN " ")) == 0) {
GdmDisplay *d;
long slave_pid;
int logged_in;
if (sscanf (msg, GDM_SOP_LOGGED_IN " %ld %d", &slave_pid,
&logged_in) != 2)
return;
/* Find out who this slave belongs to */
d = gdm_display_lookup (slave_pid);
if (d != NULL) {
d->logged_in = logged_in ? TRUE : FALSE;
gdm_debug ("Got logged in == %s",
d->logged_in ? "TRUE" : "FALSE");
/* if the user just logged out,
* let's see if it's safe to restart */
if (gdm_restart_mode &&
! d->logged_in)
gdm_safe_restart ();
/* send ack */
kill (slave_pid, SIGUSR2);
}
} else if (strcmp (msg, GDM_SOP_SOFT_RESTART) == 0) {
gdm_restart_mode = TRUE;
gdm_safe_restart ();
}
}
static gboolean
gdm_slave_socket_handler (GIOChannel *source,
GIOCondition cond,
gpointer data)
{
GdmSlaveHeader header;
gchar buf[PIPE_SIZE];
char *p;
gint len;
if (cond != G_IO_IN)
return TRUE;
if (g_io_channel_read (source, (char *)&header, sizeof (header), &len)
if (g_io_channel_read (source, buf, sizeof (buf) - 1, &len)
!= G_IO_ERROR_NONE)
return TRUE;
if (len < sizeof (header))
if (len <= 0)
return TRUE;
gdm_debug ("gdm_slave_socket_handler: opcode %d len %d",
(int) header.opcode,
(int) header.len);
/* null terminate as the string is NOT */
buf[len] = '\0';
if (header.len > 0) {
if (g_io_channel_read (source, buf, header.len, &len)
!= G_IO_ERROR_NONE)
return TRUE;
if (len != header.len)
return TRUE;
} else {
len = 0;
}
gdm_debug ("gdm_slave_socket_handler: Read %d bytes", len);
if (header.opcode <= GDM_SOP_INVALID ||
header.opcode >= GDM_SOP_LAST) {
gdm_error (_("%s: Invalid opcode"),
"gdm_slave_socket_handler");
return TRUE;
}
if (header.opcode == GDM_SOP_CHOOSER) {
gdm_choose_data (buf, header.len);
} else if (header.opcode == GDM_SOP_XPID) {
GdmXPidData data;
if (header.len == sizeof (data)) {
GdmDisplay *d;
memcpy (&data, buf, sizeof (data));
/* Find out who this slave belongs to */
d = gdm_display_lookup (data.slave_pid);
if (d != NULL) {
d->servpid = data.xpid;
}
}
} else if (header.opcode == GDM_SOP_LOGGED_IN) {
GdmLoggedInData data;
if (header.len == sizeof (data)) {
GdmDisplay *d;
memcpy (&data, buf, sizeof (data));
/* Find out who this slave belongs to */
d = gdm_display_lookup (data.slave_pid);
if (d != NULL) {
d->logged_in = data.logged_in;
/* if the user just logged out,
* let's see if it's safe to restart */
if (gdm_restart_mode &&
! data.logged_in)
gdm_safe_restart ();
}
}
p = strtok (buf, "\n");
while (p != NULL) {
handle_message (p);
p = strtok (NULL, "\n");
}
return TRUE;
......
......@@ -286,39 +286,16 @@ void gdm_quit (void);
/* primitive protocol for controlling the daemon from the chooser
* or gdmconfig or whatnot */
enum {
GDM_SOP_INVALID = 0,
GDM_SOP_CHOOSER, /* Chosen host information */
GDM_SOP_XPID, /* Pid of X server so that in case of
slave crash, daemon can kill it */
GDM_SOP_LOGGED_IN, /* status of user, if logged in or not,
useful for safe restarts */
GDM_SOP_LAST
};
typedef struct _GdmXPidData GdmXPidData;
struct _GdmXPidData {
pid_t slave_pid;
pid_t xpid;
};
typedef struct _GdmLoggedInData GdmLoggedInData;
struct _GdmLoggedInData {
pid_t slave_pid;
gboolean logged_in;
};
/* Protocol is not for use outside of gdm so endianess be damned,
* it's not really a "wire" protocol, just for the programs of the
* gdm suite. Which are all compiled on the same machine etc... etc...
* blah blah blah*/
typedef struct _GdmSlaveHeader GdmSlaveHeader;
struct _GdmSlaveHeader {
int opcode;
size_t len; /* length of data (not including header) */
};
/* The ones that pass a <slave pid> must be from a valid slave, and
* the slave will be sent a SIGUSR2 */
#define GDM_SOP_CHOSEN "CHOSEN" /* <indirect id> <ip addr> */
#define GDM_SOP_XPID "XPID" /* <slave pid> <xpid> */
#define GDM_SOP_SESSPID "SESSPID" /* <slave pid> <sesspid> */
#define GDM_SOP_GREETPID "GREETPID" /* <slave pid> <greetpid> */
#define GDM_SOP_CHOOSERPID "CHOOSERPID" /* <slave pid> <chooserpid> */
#define GDM_SOP_LOGGED_IN "LOGGED_IN" /* <slave pid> <logged_in as int> */
#define GDM_SOP_SOFT_RESTART "SOFT_RESTART" /* no arguments */
void gdm_fifo_close (void);
......
......@@ -22,10 +22,10 @@
#include "config.h"
#include "gdm.h"
void gdm_fail (const gchar *format, ...);
void gdm_info (const gchar *format, ...);
void gdm_error (const gchar *format, ...);
void gdm_debug (const gchar *format, ...);
void gdm_fail (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
void gdm_info (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
void gdm_error (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
void gdm_debug (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
#ifdef HAVE_SETENV
#define gdm_setenv(var,value) setenv(var,value,-1)
......
......@@ -96,18 +96,20 @@ gdm_server_reinit (GdmDisplay *disp)
void
gdm_server_stop (GdmDisplay *disp)
{
if (disp == NULL ||
disp->servpid <= 0)
if (disp == NULL)
return;
gdm_debug ("gdm_server_stop: Server for %s going down!", disp->name);
/* Kill our connection if one existed */
if (disp->dsp != NULL) {
XCloseDisplay (disp->dsp);
disp->dsp = NULL;
XCloseDisplay (disp->dsp);
disp->dsp = NULL;
}
if (disp->servpid <= 0)
return;
gdm_debug ("gdm_server_stop: Server for %s going down!", disp->name);
disp->servstat = SERVER_DEAD;
if (disp->servpid != 0) {
......@@ -296,7 +298,7 @@ gdm_server_start (GdmDisplay *disp)
switch (d->servstat) {
case SERVER_TIMEOUT:
gdm_debug ("gdm_server_start: Temporary server failure (%d)", d->name);
gdm_debug ("gdm_server_start: Temporary server failure (%s)", d->name);
break;
case SERVER_ABORT:
......
......@@ -127,17 +127,19 @@ static void gdm_slave_session_cleanup (void);
static void gdm_slave_alrm_handler (int sig);
static void gdm_slave_term_handler (int sig);
static void gdm_slave_child_handler (int sig);
static void gdm_slave_exit (gint status, const gchar *format, ...);
static void gdm_child_exit (gint status, const gchar *format, ...);
static void gdm_slave_usr2_handler (int sig);
static void gdm_slave_exit (gint status, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
static void gdm_child_exit (gint status, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
static gint gdm_slave_exec_script (GdmDisplay *d, const gchar *dir,
const char *login, struct passwd *pwent);
static gchar * gdm_parse_enriched_login (const gchar *s, GdmDisplay *display);
static void gdm_send_logged_in (gboolean logged_in);
static void gdm_send_xpid (pid_t xpid);
static void gdm_send_pid (const char *opcode, pid_t pid);
/* Yay thread unsafety */
static gboolean x_error_occured = FALSE;
static gboolean gdm_got_usr2 = FALSE;
/* ignore handlers */
static int
......@@ -159,7 +161,7 @@ gdm_slave_start (GdmDisplay *display)
{
time_t first_time;
int death_count;
struct sigaction alrm, term, child;
struct sigaction alrm, term, child, usr2;
if (!display)
return;
......@@ -197,11 +199,21 @@ gdm_slave_start (GdmDisplay *display)
if (sigaction (SIGCHLD, &child, NULL) < 0)
gdm_slave_exit (DISPLAY_ABORT, _("gdm_slave_init: Error setting up CHLD signal handler"));
/* Handle a USR2 which is ack from master that it received a message */
usr2.sa_handler = gdm_slave_usr2_handler;
usr2.sa_flags = SA_RESTART;
sigemptyset (&usr2.sa_mask);
sigaddset (&usr2.sa_mask, SIGUSR2);
if (sigaction (SIGUSR2, &usr2, NULL) < 0)
gdm_slave_exit (DISPLAY_ABORT, _("%s: Error setting up USR2 signal handler"), "gdm_slave_init");
/* The signals we wish to listen to */
sigfillset (&mask);
sigdelset (&mask, SIGINT);
sigdelset (&mask, SIGTERM);
sigdelset (&mask, SIGCHLD);
sigdelset (&mask, SIGUSR2);
if (display->type != TYPE_LOCAL &&
GdmPingInterval > 0) {
sigdelset (&mask, SIGALRM);
......@@ -241,7 +253,7 @@ gdm_slave_start (GdmDisplay *display)
/* Whack the server if we want to restart it next time
* we run gdm_slave_run */
gdm_server_stop (display);
gdm_send_xpid (0);
gdm_send_pid (GDM_SOP_XPID, 0);
} else {
/* OK about to start again so redo our cookies and reinit
* the server */
......@@ -353,7 +365,7 @@ gdm_slave_run (GdmDisplay *display)
if (d->type == TYPE_LOCAL &&
d->servpid <= 0) {
gdm_server_start (d);
gdm_send_xpid (d->servpid);
gdm_send_pid (GDM_SOP_XPID, d->servpid);
}
gdm_setenv ("XAUTHORITY", d->authfile);
......@@ -473,6 +485,8 @@ gdm_slave_whack_greeter (void)
waitpid (d->greetpid, 0, 0);
d->greetpid = 0;
gdm_send_pid (GDM_SOP_GREETPID, 0);
if (greeter != NULL)
fclose (greeter);
greeter = NULL;
......@@ -1127,50 +1141,54 @@ gdm_slave_greeter (void)
gdm_debug ("gdm_slave_greeter: Greeter on pid %d", d->greetpid);
gdm_send_pid (GDM_SOP_GREETPID, d->greetpid);
run_pictures (); /* Append pictures to greeter if browsing is on */
break;
}
}
static void
gdm_send_xpid (pid_t xpid)
gdm_send_pid (const char *opcode, pid_t pid)
{
GdmSlaveHeader header;
GdmXPidData data;
char *msg;
int fd;
char *fifopath;
gdm_debug ("Sending X pid == %ld for slave %ld",
(long)xpid,
gdm_debug ("Sending %s == %ld for slave %ld",
opcode,
(long)pid,
(long)getpid ());
gdm_got_usr2 = FALSE;
fifopath = g_strconcat (GdmServAuthDir, "/.gdmfifo", NULL);
fd = open (fifopath, O_WRONLY);
/* eek */
if (fd < 0) {
gdm_error (_("%s: Can't open fifo!"), "gdm_send_logged_in");
gdm_error (_("%s: Can't open fifo!"), "gdm_send_pid");
return;
}
header.opcode = GDM_SOP_XPID;
header.len = sizeof (data);
msg = g_strdup_printf ("\n%s %ld %ld\n", opcode,
(long)getpid (), (long)pid);
data.slave_pid = getpid ();
data.xpid = xpid;
write (fd, msg, strlen (msg));
write (fd, &header, sizeof (header));
write (fd, &data, sizeof (data));
g_free (msg);
close (fd);
if ( ! gdm_got_usr2)
sleep (10);
}
static void
gdm_send_logged_in (gboolean logged_in)
{
GdmSlaveHeader header;
GdmLoggedInData data;
char *msg;
int fd;
char *fifopath;
......@@ -1178,6 +1196,8 @@ gdm_send_logged_in (gboolean logged_in)
logged_in ? "TRUE" : "FALSE",
(long)getpid ());
gdm_got_usr2 = FALSE;
fifopath = g_strconcat (GdmServAuthDir, "/.gdmfifo", NULL);
fd = open (fifopath, O_WRONLY);
......@@ -1187,23 +1207,23 @@ gdm_send_logged_in (gboolean logged_in)
return;
}
header.opcode = GDM_SOP_LOGGED_IN;
header.len = sizeof (data);
msg = g_strdup_printf ("\n%s %ld %d\n", GDM_SOP_LOGGED_IN,
(long)getpid (), (int)logged_in);
data.slave_pid = getpid ();
data.logged_in = logged_in;
write (fd, msg, strlen (msg));
write (fd, &header, sizeof (header));
write (fd, &data, sizeof (data));
g_free (msg);
close (fd);
if ( ! gdm_got_usr2)
sleep (10);
}
static void
send_chosen_host (GdmDisplay *disp, const char *hostname)
{
GdmSlaveHeader header;
GdmChooseData data;
char *msg;
int fd;
char *fifopath;
struct hostent *host;
......@@ -1228,15 +1248,13 @@ send_chosen_host (GdmDisplay *disp, const char *hostname)
return;
}
header.opcode = GDM_SOP_CHOOSER;
header.len = sizeof (GdmChooseData);
msg = g_strdup_printf ("\n%s %d %s\n", GDM_SOP_CHOSEN,
disp->indirect_id,
inet_ntoa (*((struct in_addr *)host->h_addr_list[0])));
data.id = disp->indirect_id;
memcpy (&(data.addr), (struct in_addr *)host->h_addr_list[0],
sizeof (struct in_addr));
write (fd, msg, strlen (msg));
write (fd, &header, sizeof (header));
write (fd, &data, sizeof (data));
g_free (msg);
close (fd);
}
......@@ -1263,7 +1281,7 @@ gdm_slave_chooser (void)
/* Fork. Parent is gdmslave, child is greeter process. */
last_killed_pid = 0; /* race condition wrapper,
* it could be that we recieve sigchld before