summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-09-10 15:28:20 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-09-10 17:02:21 +0200
commit2b99f5e02c3b177375e6641d9a829e39a11431b3 (patch)
tree4a8b1ab0335858a3cb06fc891faa3692e1a664c6
parent4fb5a643c8babd6b42776642c111c8a7a38b0e32 (diff)
downloadcurl-2b99f5e02c3b177375e6641d9a829e39a11431b3.tar.gz
parse_args: redo the warnings for --remote-header-name combos
... to avoid the memory leak risk pointed out by scan-build. Follow-up from 7a3e981781d6c18a Closes #7698
-rw-r--r--src/tool_getparam.c16
-rw-r--r--src/tool_getparam.h4
-rw-r--r--src/tool_helpers.c6
3 files changed, 13 insertions, 13 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 56fc35cf5..1e1827fc1 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -2384,17 +2384,11 @@ ParameterError parse_args(struct GlobalConfig *global, int argc,
curlx_unicodefree(orig_opt);
}
- if(config->content_disposition) {
- if(config->show_headers) {
- helpf(global->errors, "--include and --remote-header-name "
- "cannot be combined.\n");
- return PARAM_BAD_USE;
- }
- if(config->resume_from_current) {
- helpf(global->errors, "--continue-at - and --remote-header-name "
- "cannot be combined.\n");
- return PARAM_BAD_USE;
- }
+ if(!result && config->content_disposition) {
+ if(config->show_headers)
+ result = PARAM_CONTDISP_SHOW_HEADER;
+ else if(config->resume_from_current)
+ result = PARAM_CONTDISP_RESUME_FROM;
}
if(result && result != PARAM_HELP_REQUESTED &&
diff --git a/src/tool_getparam.h b/src/tool_getparam.h
index 2c24d4835..599a0ac88 100644
--- a/src/tool_getparam.h
+++ b/src/tool_getparam.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -43,6 +43,8 @@ typedef enum {
PARAM_NO_PREFIX,
PARAM_NUMBER_TOO_LARGE,
PARAM_NO_NOT_BOOLEAN,
+ PARAM_CONTDISP_SHOW_HEADER, /* --include and --remote-header-name */
+ PARAM_CONTDISP_RESUME_FROM, /* --continue-at and --remote-header-name */
PARAM_LAST
} ParameterError;
diff --git a/src/tool_helpers.c b/src/tool_helpers.c
index 8cd2ac58a..04b0510be 100644
--- a/src/tool_helpers.c
+++ b/src/tool_helpers.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -68,6 +68,10 @@ const char *param2text(int res)
return "too large number";
case PARAM_NO_NOT_BOOLEAN:
return "used '--no-' for option that isn't a boolean";
+ case PARAM_CONTDISP_SHOW_HEADER:
+ return "--include and --remote-header-name cannot be combined";
+ case PARAM_CONTDISP_RESUME_FROM:
+ return "--continue-at and --remote-header-name cannot be combined";
default:
return "unknown error";
}