Skip to contentSkip to conversation

Stop ctrl-c from aborting detached hciattach

PATCH New Frank Mandarino 1 participant 1 message Oct 5, 2006 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Stop ctrl-c from aborting detached hciattach

Hi,

I was running some test programs on my embedded system, and noticed that
my detached hciattach process, which I started from the command line,
was being killed when I entered ctrl-c to abort my test program.

The attached patch prevents signals generated by keyboard sequences, such as ctrl-c, from being delivered to the detached hciattach process by changing its process group id.

I'm not sure why daemon() wasn't called to create the detached process like hcid does it, but calling setpgrp() seems to be sufficient.

Regards,
../fam

Signature · 3 lines
Frank Mandarino                                fmandarino(a)endrelia.com
Endrelia Technologies Inc.
Toronto, Ontario, Canada

Index: hciattach.c
===================================================================
RCS file: /cvsroot/bluez/utils/tools/hciattach.c,v retrieving revision 1.41

hciattach.c +4 -0
diff -u -r1.41 hciattach.c
@@ -1255,6 +1255,10 @@
 			return 0;
 		}
 
+		/* set a new process group so that ctrl-c
+		   won't abort the detached process */
+		setpgrp();
+
 		for (i = 0; i < 20; i++)
 			if (i != n)
 				close(i);

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel