Index: console/console.c
===================================================================
--- console/console.c	(revision 74ebc645385b1ceb35ef189cf368887633ec8353)
+++ console/console.c	(revision d32af35c83dc913b2f1e3efb367b50592c865c31)
@@ -79,29 +79,13 @@
  *
  */
-static int find_free_connection() 
+static int find_free_connection(void) 
 {
 	int i = 0;
 	
-	while (i < CONSOLE_COUNT) {
-		if (connections[i].used == 0)
+	for (i=0; i < CONSOLE_COUNT; i++) {
+		if (!connections[i].used)
 			return i;
-		++i;
-	}
-	return CONSOLE_COUNT;
-}
-
-/** Find index of virtual console used by client with given phone.
- *
- */
-static int find_connection(int client_phone) 
-{
-	int i = 0;
-	
-	while (i < CONSOLE_COUNT) {
-		if (connections[i].client_phone == client_phone)
-			return i;
-		++i;
-	}
-	return  CONSOLE_COUNT;
+	}
+	return -1;
 }
 
@@ -340,5 +324,5 @@
 	ipcarg_t arg1, arg2;
 
-	if ((consnum = find_free_connection()) == CONSOLE_COUNT) {
+	if ((consnum = find_free_connection()) == -1) {
 		ipc_answer_fast(iid,ELIMIT,0,0);
 		return;
@@ -449,5 +433,5 @@
 	gcons_init(fb_info.phone);
 	/* Synchronize, the gcons can have something in queue */
-	sync_send_2(fb_info.phone, FB_GET_CSIZE, 0, 0, NULL, NULL);
+	sync_send(fb_info.phone, FB_FLUSH, 0, NULL);
 
 	
@@ -470,4 +454,5 @@
 		}
 	}
+	connections[KERNEL_CONSOLE].used = 1;
 	
 	if ((interbuffer = mmap(NULL, sizeof(keyfield_t) * fb_info.cols * fb_info.rows , PROTO_READ|PROTO_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 0 ,0 )) != NULL) {
