uclient-fetch: fix progress bar initialization with -O-
authorFelix Fietkau <nbd@openwrt.org>
Sat, 23 Jan 2016 18:52:58 +0000 (19:52 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 23 Jan 2016 18:52:58 +0000 (19:52 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
uclient-fetch.c

index d2ffde3f89423d975d38a730023d59db645c9217..ebf49ae559ac395fbd069ab53c3d1e29da42f4be 100644 (file)
@@ -115,7 +115,8 @@ static int open_output_file(const char *path, uint64_t resume_offset)
                        if (!quiet)
                                fprintf(stderr, "Writing to stdout\n");
 
-                       return STDOUT_FILENO;
+                       ret = STDOUT_FILENO;
+                       goto done;
                }
        } else {
                filename = uclient_get_url_filename(path, "index.html");
@@ -139,6 +140,7 @@ static int open_output_file(const char *path, uint64_t resume_offset)
 
        out_offset = resume_offset;
        out_bytes += resume_offset;
+done:
        if (!quiet) {
                progress_init(&pmt, output_file);
                pmt_timer.cb = pmt_update;