uclient-fetch: allow overwriting files if -O was used
[project/uclient.git] / uclient-fetch.c
index 3f875c9aea0a87feb380caa5aa11e8ccba1c83b4..223d3641683b5519f7db5305597db05148543494 100644 (file)
@@ -103,7 +103,10 @@ static int open_output_file(const char *path, uint64_t resume_offset)
        if (cur_resume)
                flags = O_RDWR;
        else
-               flags = O_WRONLY | O_EXCL;
+               flags = O_WRONLY;
+
+       if (!cur_resume && !output_file)
+               flags |= O_EXCL;
 
        flags |= O_CREAT;
 
@@ -361,6 +364,7 @@ static void eof_cb(struct uclient *cl)
        if (!quiet) {
                pmt_update(&pmt_timer);
                uloop_timeout_cancel(&pmt_timer);
+               fprintf(stderr, "\n");
        }
 
        if (!cl->data_eof) {
@@ -518,7 +522,7 @@ int main(int argc, char **argv)
        signal(SIGPIPE, SIG_IGN);
        init_ustream_ssl();
 
-       while ((ch = getopt_long(argc, argv, "cO:P:qsU:Y:", longopts, &longopt_idx)) != -1) {
+       while ((ch = getopt_long(argc, argv, "cO:P:qsT:U:Y:", longopts, &longopt_idx)) != -1) {
                switch(ch) {
                case 0:
                        switch (longopt_idx) {