View | Details | Raw Unified | Return to bug 1153 | Differences between
and this patch

Collapse All | Expand All

(-)session.c (-2 / +31 lines)
Lines 1193-1199 static void Link Here
1193
do_rc_files(Session *s, const char *shell)
1193
do_rc_files(Session *s, const char *shell)
1194
{
1194
{
1195
	FILE *f = NULL;
1195
	FILE *f = NULL;
1196
	char cmd[1024];
1196
	char cmd[1024], dpy[1024];
1197
	int do_xauth;
1197
	int do_xauth;
1198
	struct stat st;
1198
	struct stat st;
1199
1199
Lines 1248-1257 do_rc_files(Session *s, const char *shel Link Here
1248
			fprintf(f, "add %s %s %s\n",
1248
			fprintf(f, "add %s %s %s\n",
1249
			    s->auth_display, s->auth_proto,
1249
			    s->auth_display, s->auth_proto,
1250
			    s->auth_data);
1250
			    s->auth_data);
1251
			pclose(f);
1251
			if (pclose(f) != 0)
1252
				error("%s failed.", options.xauth_location);
1252
		} else {
1253
		} else {
1253
			fprintf(stderr, "Could not run %s\n",
1254
			fprintf(stderr, "Could not run %s\n",
1254
			    cmd);
1255
			    cmd);
1256
			return;
1257
		}
1258
		if (options.x11_use_localhost)
1259
			return;
1260
		snprintf(cmd, sizeof cmd, "%s -q list %s",
1261
		    options.xauth_location, s->auth_display);
1262
		f = popen(cmd, "r");
1263
		if (f) {
1264
			if (fgets(cmd, sizeof(cmd), f) == NULL) {
1265
				error("Could not read xauth data: %s",
1266
				    strerror(errno));
1267
			} else {
1268
				if (sscanf(cmd, "%1024s %*s %*s", dpy) != 1) {
1269
					error("Bad xauth data");
1270
				} else {
1271
					debug("xauth returned display %s",
1272
					    s->display);
1273
					xfree(s->display);
1274
					s->display = xstrdup(dpy);
1275
					setenv("DISPLAY", s->display, 1);
1276
				}
1277
			}
1278
			if (pclose(f) != 0)
1279
				error("%s failed.", options.xauth_location);
1280
		} else {
1281
			fprintf(stderr, "Could not run %s list\n",
1282
			    cmd);
1283
			return;
1255
		}
1284
		}
1256
	}
1285
	}
1257
}
1286
}

Return to bug 1153