polarssl: fix error check on write
[project/ustream-ssl.git] / ustream-example.c
index b3cbe763df5c579ff325a0ae79f27f5b0fb836f7..3e10543db12da365319a9d4192be7da3f866afc0 100644 (file)
@@ -1,3 +1,21 @@
+/*
+ * ustream-ssl - library for SSL over ustream
+ *
+ * Copyright (C) 2012 Felix Fietkau <nbd@openwrt.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
 #include <sys/socket.h>
 #include <netinet/in.h>
 
@@ -5,6 +23,8 @@
 #include <getopt.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
+#include <signal.h>
 
 #include <libubox/ustream.h>
 #include <libubox/uloop.h>
@@ -180,6 +200,7 @@ int main(int argc, char **argv)
 {
        int ch;
 
+       signal(SIGPIPE, SIG_IGN);
        ctx = ustream_ssl_context_new(true);
        ustream_ssl_context_set_crt_file(ctx, "example.crt");
        ustream_ssl_context_set_key_file(ctx, "example.key");