Obsolete VTE pre-2.91 ABI
[oi-userland.git] / components / desktop / lightdm / patches / 16-create-device.patch
blob58b44d7f27ffa862b5eddbfa3af25dc4e26bd424
1 --- lightdm-1.19.3/src/session.c 2016-08-12 00:32:27.703931801 +0300
2 +++ session.c 2016-08-12 00:32:21.342169373 +0300
3 @@ -20,6 +20,10 @@
4 #include <glib/gstdio.h>
5 #include <grp.h>
6 #include <pwd.h>
7 +#ifdef __sun__
8 +#include <sys/param.h>
9 +#include <utime.h>
10 +#endif
12 #ifdef HAVE_SMF_CONTRACTS
13 #include <sys/ctfs.h>
14 @@ -137,6 +137,49 @@
15 G_IMPLEMENT_INTERFACE (
16 LOGGER_TYPE, session_logger_iface_init));
18 +#ifdef __sun__
19 +static void
20 +create_device (const char *dev);
22 +static void
23 +create_device (const char *dev)
25 + gchar buf[MAXPATHLEN + 1];
26 + struct stat st;
28 + if (dev == NULL || dev[0] == '\0')
29 + return;
31 + if (strcmp (dev, "/dev/dtlocal") != 0 &&
32 + strcmp (dev, "/dev/dtremote") != 0 )
33 + return;
35 + memset (buf, 0, sizeof (gchar) * (MAXPATHLEN + 1));
37 + if (stat (dev, &st) != 0) {
38 + g_debug ("Creating pseudo-device %s", dev);
39 + symlink ("/dev/null", dev);
40 + } else if (readlink (dev, buf, MAXPATHLEN) > 0) {
41 + if (strcmp (buf, "/dev/null") == 0) {
42 + /* Touch symlink */
43 + struct utimbuf timebuf;
45 + timebuf.modtime = time ((time_t *) 0);
46 + timebuf.actime = timebuf.modtime;
48 + if ((utime (dev, &timebuf)) != 0)
49 + g_debug ("Problem updating access time of pseudo-device %s", dev);
50 + else
51 + g_debug ("Touching pseudo-device %s", dev);
52 + } else {
53 + g_debug ("Device %s points to %s", dev, buf);
54 + }
55 + } else {
56 + g_debug ("Device %s is not a symlink", dev);
57 + }
59 +#endif
61 #ifdef HAVE_SMF_CONTRACTS
62 static int contracts_fd = -1;
64 @@ -761,6 +761,14 @@
65 version = 3;
66 write_data (session, &version, sizeof (version));
68 +#ifdef __sun__
69 + if(priv->remote_host_name) {
70 + create_device("/dev/dtremote");
71 + } else if (!g_str_equal (priv->xdisplay,":0")) {
72 + create_device("/dev/dtlocal");
73 + }
74 +#endif
76 /* Send configuration */
77 write_string (session, session->priv->pam_service);
78 write_string (session, session->priv->username);