[OpenWrt-Devel] uclient & libubox: handling SIGPIPE / EPIPE

John Crispin blogic at openwrt.org
Wed Jan 21 07:28:10 EST 2015



On 21/01/2015 11:32, Rafał Miłecki wrote:
> I'm trying to use uclient to monitor my home network servers querying
> http://ip/status . So far I was using bash + curl, but I'm trying to
> learn libubox now.
> 
> So today I accidentally queried some unknown machine (random IP) and
> my app crashed.
> 
> What has happened:
> 
> 1) When I first called "uclient_request", uclient opened socket and wrote
> GET /status HTTP/1.1
> Host: 192.168.0.136
> 
> Inside the "ustream_fd_write", write returned -1 and errno was EAGAIN.
> 
> 2) After handling control back to uloop there was another try of sending
> GET /status HTTP/1.1
> Host: 192.168.0.136
> 
> but this time it has failed badly during the "write" call. There was
> SIGPIPE that wasn't handled and my app has been terminated.
> 
> 
> Should we somehow handle SIGPIPE in uclient or disable it using SO_NOSIGPIPE?
> 

services like procd do

-> signal(SIGPIPE, SIG_IGN);

this should really be changed to work with 464e05e3 from libubox.git
unless i missed something it might be a good idea to add PIP to
uloop_setup_signals()
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list