aboutsummaryrefslogtreecommitdiff
path: root/lib/mime.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-09-17 23:31:49 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-09-18 23:15:41 +0200
commitbec50cc285995b18d57e5e5caf17e33100795f09 (patch)
treef8d32cea39ca8e06618c14ef03cbeff1e74015f6 /lib/mime.c
parente239eda39e3f0f9342bc0dd6658b49d4bd900875 (diff)
mime:escape_string minor clarification change
... as it also removes a warning with old gcc versions. Bug: https://curl.haxx.se/mail/lib-2017-09/0049.html Reported-by: Ben Greear
Diffstat (limited to 'lib/mime.c')
-rw-r--r--lib/mime.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/mime.c b/lib/mime.c
index 9f3d40f1a..312094d7f 100644
--- a/lib/mime.c
+++ b/lib/mime.c
@@ -296,9 +296,12 @@ static char *escape_string(const char *src, size_t len)
for(i = 0; len; len--) {
char c = *src++;
- if(c == '"' || c == '\\' || !c)
+ if(c == '"' || c == '\\' || !c) {
dst[i++] = '\\';
- dst[i++] = c? c: '0';
+ if(!c)
+ c = '0';
+ }
+ dst[i++] = c;
}
dst[i] = '\0';