WiP
[oweals/gnunet.git] / src / monkey / gdbmi_get_free_vt.c
index ac5c222f0ec6609b0ebaed06bd08228f59c8704a..25e5e75a7f7299727704259031cab9d5a9772564 100644 (file)
@@ -92,8 +92,10 @@ int mi_look_for_free_vt()
    }
 
  /* Get the state of the console -- in particular, the free VT field */
- if (ioctl(console_fd,VT_GETSTATE,&vts))
+ if (ioctl(console_fd,VT_GETSTATE,&vts)) {
+        close(console_fd);
     return -2;
+ }
  close(console_fd);
 
  /* We attempt to set our euid to 0; if we were run with euid 0 to
@@ -136,6 +138,7 @@ release it.
 
 mi_aux_term *gmi_look_for_free_vt()
 {
+ int ret;
  int vt=mi_look_for_free_vt();
  mi_aux_term *res;
 
@@ -145,7 +148,7 @@ mi_aux_term *gmi_look_for_free_vt()
  if (!res)
     return NULL;
  res->pid=-1;
- asprintf(&res->tty,"/dev/tty%d",vt);
ret = asprintf(&res->tty,"/dev/tty%d",vt);
  return res;
 }