example: close output file
authorFelix Fietkau <nbd@openwrt.org>
Sun, 4 May 2014 18:17:47 +0000 (20:17 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 4 May 2014 18:17:47 +0000 (20:17 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
uclient-example.c

index 2874ec2fefb2abf89a7154bd13714dd9313b6305..bee5068e9d220ed937a60faff3b2043d918ee8b0 100644 (file)
@@ -85,6 +85,10 @@ static int open_output_file(const char *path, bool create)
 
 static void request_done(struct uclient *cl)
 {
+       if (output_fd >= 0) {
+               close(output_fd);
+               output_fd = -1;
+       }
        uclient_disconnect(cl);
        uloop_end();
 }