* [Bluez-devel] [PATCH] Check return code of pin helper.
@ 2003-04-27 10:50 David Woodhouse
2003-04-27 12:58 ` David Woodhouse
0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2003-04-27 10:50 UTC (permalink / raw)
To: bluez-devel
On Red Hat 9, the python interpreter segfaults when running bluepin if
hcid is started from the init script, but it all works fine if hcid was
started from a command prompt. This confuses me, but it confused me even
more before I make hcid report what was happening...
Apr 27 11:42:35 imladris hcid[31158]: PIN helper exited abnormally with code 11
--- bluez-utils-2.3/hcid/security.c~ 2003-03-20 05:58:12.000000000 +0000
+++ bluez-utils-2.3/hcid/security.c 2003-04-27 11:34:41.000000000 +0100
@@ -224,10 +224,11 @@
static void call_pin_helper(int dev, struct hci_conn_info *ci)
{
pin_code_reply_cp pr;
+ struct sigaction sa;
char str[255], *pin, name[20];
bdaddr_t ba;
FILE *pipe;
- int len;
+ int len, ret;
/* Run PIN helper in the separate process */
switch (fork()) {
@@ -256,6 +257,11 @@
setenv("PATH", "/bin:/usr/bin:/usr/local/bin", 1);
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_flags = SA_NOCLDSTOP;
+ sa.sa_handler = SIG_DFL;
+ sigaction(SIGCHLD, &sa, NULL);
+
pipe = popen(str, "r");
if (!pipe) {
syslog(LOG_ERR, "Can't exec PIN helper. %s(%d)", strerror(errno), errno);
@@ -263,15 +269,15 @@
}
pin = fgets(str, sizeof(str), pipe);
- pclose(pipe);
+ ret = pclose(pipe);
if (!pin || strlen(pin) < 5)
- goto reject;
+ goto nopin;
strtok(pin, "\n\r");
if (strncmp("PIN:", pin, 4))
- goto reject;
+ goto nopin;
pin += 4;
len = strlen(pin);
@@ -284,6 +290,10 @@
PIN_CODE_REPLY_CP_SIZE, &pr);
exit(0);
+ nopin:
+ if (!pin || strncmp("ERR", pin, 3))
+ syslog(LOG_ERR, "PIN helper exited abnormally with code %d\n", ret);
+
reject:
hci_send_cmd(dev, OGF_LINK_CTL, OCF_PIN_CODE_NEG_REPLY, 6, &ci->bdaddr);
exit(0);
--
dwmw2
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Bluez-devel] [PATCH] Check return code of pin helper.
2003-04-27 10:50 [Bluez-devel] [PATCH] Check return code of pin helper David Woodhouse
@ 2003-04-27 12:58 ` David Woodhouse
2003-04-28 21:55 ` Max Krasnyansky
0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2003-04-27 12:58 UTC (permalink / raw)
To: bluez-devel
On Sun, 2003-04-27 at 11:50, David Woodhouse wrote:
> On Red Hat 9, the python interpreter segfaults when running bluepin if
> hcid is started from the init script, but it all works fine if hcid was
> started from a command prompt. This confuses me,
This no longer confuses me. It's a fontconfig bug when there's no 'HOME'
in the environment. Fixing the segfault in libfontconfig leaves bluepin
still not working -- although setting $HOME to something bogus _does_
work. I've worked around it in bluepin in the bluez-utils-2.3-4 package
which should be in rawhide some time soon.
--
dwmw2
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Bluez-devel] [PATCH] Check return code of pin helper.
2003-04-27 12:58 ` David Woodhouse
@ 2003-04-28 21:55 ` Max Krasnyansky
2003-04-29 6:47 ` David Woodhouse
2003-04-29 21:04 ` David Woodhouse
0 siblings, 2 replies; 5+ messages in thread
From: Max Krasnyansky @ 2003-04-28 21:55 UTC (permalink / raw)
To: David Woodhouse, bluez-devel
At 05:58 AM 4/27/2003, David Woodhouse wrote:
>On Sun, 2003-04-27 at 11:50, David Woodhouse wrote:
>> On Red Hat 9, the python interpreter segfaults when running bluepin if
>> hcid is started from the init script, but it all works fine if hcid was
>> started from a command prompt. This confuses me,
>
>This no longer confuses me. It's a fontconfig bug when there's no 'HOME'
>in the environment. Fixing the segfault in libfontconfig leaves bluepin
>still not working -- although setting $HOME to something bogus _does_
>work. I've worked around it in bluepin in the bluez-utils-2.3-4 package
>which should be in rawhide some time soon.
You said that bluepin still doesn't work even if you fix libfontconfig.
Do you know why ?
btw I want to replace Python bluepin script with a little gtk app in
later versions of bluez-utils.
Max
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-04-29 21:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-27 10:50 [Bluez-devel] [PATCH] Check return code of pin helper David Woodhouse
2003-04-27 12:58 ` David Woodhouse
2003-04-28 21:55 ` Max Krasnyansky
2003-04-29 6:47 ` David Woodhouse
2003-04-29 21:04 ` David Woodhouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).