# SIGWINCH handling cleanups -
#      Reformatting of comments and code
#      Closed a memory and fd leak by freeing a winch structure and
# everything associated with it if communication with the winch thread
# dies for some reason.
#
# free_winch in winch_interrupt may be wrong, as it calls free_irq
# winch_handler_lock needs to become _irqsave
# register_winch_irq may need to return int

Index: linux-2.6.17/arch/um/drivers/line.c
===================================================================
--- linux-2.6.17.orig/arch/um/drivers/line.c	2007-10-24 10:04:50.000000000 -0400
+++ linux-2.6.17/arch/um/drivers/line.c	2007-11-19 11:56:04.000000000 -0500
@@ -802,6 +802,7 @@ void register_winch_irq(int fd, int tty_
 			unsigned long stack)
 {
 	struct winch *winch;
+	int err;
 
 	winch = kmalloc(sizeof(*winch), GFP_KERNEL);
 	if (winch == NULL) {
@@ -816,11 +817,12 @@ void register_winch_irq(int fd, int tty_
 				   .tty 	= tty,
 				   .stack	= stack });
 
-	if (um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
-			   IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM,
-			   "winch", winch) < 0) {
+	err = um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
+			     IRQF_DISABLED | IRQF_SHARED | IRQF_SAMPLE_RANDOM,
+			     "winch", winch);
+	if (err) {
 		printk(KERN_ERR "register_winch_irq - failed to register "
-		       "IRQ\n");
+		       "IRQ - err = %d\n", err);
 		goto out_free;
 	}
 
@@ -881,6 +883,7 @@ char *add_xterm_umid(char *base)
 	if (*umid == '\0')
 		return base;
 
+
 	len = strlen(base) + strlen(" ()") + strlen(umid) + 1;
 	title = kmalloc(len, GFP_KERNEL);
 	if (title == NULL) {