summaryrefslogtreecommitdiff
blob: 5fdc9af1a2e061463eabd79458706619c6cdd2ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- branches/KDE/3.5/kdebase/kdmlib/dmctl.cpp	2006/10/31 11:38:26	600659
+++ branches/KDE/3.5/kdebase/kdmlib/dmctl.cpp	2007/11/01 22:10:25	731815
@@ -65,21 +65,28 @@
 		if ((fd = ::socket( PF_UNIX, SOCK_STREAM, 0 )) < 0)
 			return;
 		sa.sun_family = AF_UNIX;
-		if (DMType == GDM)
-			strcpy( sa.sun_path, "/tmp/.gdm_socket" );
-		else {
+		if (DMType == GDM) {
+			strcpy( sa.sun_path, "/var/run/gdm_socket" );
+			if (::connect( fd, (struct sockaddr *)&sa, sizeof(sa) )) {
+				strcpy( sa.sun_path, "/tmp/.gdm_socket" );
+				if (::connect( fd, (struct sockaddr *)&sa, sizeof(sa) )) {
+					::close( fd );
+					fd = -1;
+					break;
+				}
+			}
+			GDMAuthenticate();
+		} else {
 			if ((ptr = strchr( dpy, ':' )))
 				ptr = strchr( ptr, '.' );
 			snprintf( sa.sun_path, sizeof(sa.sun_path),
 			          "%s/dmctl-%.*s/socket",
-			          ctl, ptr ? ptr - dpy : 512, dpy );
-		}
-		if (::connect( fd, (struct sockaddr *)&sa, sizeof(sa) )) {
-			::close( fd );
-			fd = -1;
+			          ctl, ptr ? int(ptr - dpy) : 512, dpy );
+			if (::connect( fd, (struct sockaddr *)&sa, sizeof(sa) )) {
+				::close( fd );
+				fd = -1;
+			}
 		}
-		if (DMType == GDM)
-			GDMAuthenticate();
 		break;
 	case OldKDM:
 		{