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

Rafał Miłecki zajec5 at gmail.com
Wed Jan 21 05:32:12 EST 2015

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

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

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?

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list