This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH,HURD]: Fix uninitialized newctty variable


Hello,

The patch below fixes an unitialized variable issue.

Samuel

2009-12-22  Samuel Thibault  <samuel.thibault@ens-lyon.org>

	* hurd/hurdioctl.c (_hurd_locked_install_cttyid): Set newctty to
	MACH_PORT_NULL when id != cttyid.

diff --git a/hurd/hurdioctl.c b/hurd/hurdioctl.c
index 96d910b..b3c9605 100644
--- a/hurd/hurdioctl.c
+++ b/hurd/hurdioctl.c
@@ -184,12 +184,16 @@ _hurd_locked_install_cttyid (mach_port_t cttyid)
 			  /* Get the io object's cttyid port.  */
 			  if (! __term_getctty (port, &id))
 			    {
-			      if (id == cttyid && /* Is it ours?  */
+			      if (id == cttyid) /* Is it ours?  */
+				{
 				  /* Get the ctty io port.  */
-				  __term_open_ctty (port,
-						    _hurd_pid, _hurd_pgrp,
-						    &newctty))
-				/* XXX it is our ctty but the call failed? */
+				  if (__term_open_ctty (port,
+							_hurd_pid, _hurd_pgrp,
+							&newctty))
+				    /* XXX it is our ctty but the call failed? */
+				    newctty = MACH_PORT_NULL;
+				}
+			      else
 				newctty = MACH_PORT_NULL;
 			      __mach_port_deallocate
 				(__mach_task_self (), (mach_port_t) id);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]