static bool proxy = true;
static bool default_certs = false;
static bool no_output;
-static const char *output_file;
+static const char *opt_output_file;
static int output_fd = -1;
static int error_ret;
static off_t out_offset;
static int open_output_file(const char *path, uint64_t resume_offset)
{
+ const char *output_file = opt_output_file;
char *filename = NULL;
int flags;
int ret;
}
} else {
filename = uclient_get_url_filename(path, "index.html");
+ if (!filename) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
output_file = filename;
}
free:
free(filename);
+out:
return ret;
}
return;
}
- if (output_fd >= 0 && !output_file) {
+ if (output_fd >= 0 && !opt_output_file) {
close(output_fd);
output_fd = -1;
}
{
fprintf(stderr,
"%s: SSL support not available, please install one of the "
- "libustream-ssl-* libraries as well as the ca-bundle and "
+ "libustream-.*[ssl|tls] packages as well as the ca-bundle and "
"ca-certificates packages.\n",
progname);
user_agent = optarg;
break;
case 'O':
- output_file = optarg;
+ opt_output_file = optarg;
break;
case 'P':
if (chdir(optarg)) {