Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
0af2c245
Commit
0af2c245
authored
Nov 13, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure the CLI headers we produce tell the truth about the length
parent
2144dc78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
cli_common.c
lib/libvarnish/cli_common.c
+6
-2
No files found.
lib/libvarnish/cli_common.c
View file @
0af2c245
...
...
@@ -87,6 +87,7 @@ VCLI_WriteResult(int fd, unsigned status, const char *result)
int
i
,
l
;
struct
iovec
iov
[
3
];
char
nl
[
2
]
=
"
\n
"
;
size_t
len
;
char
res
[
CLI_LINE0_LEN
+
2
];
/*
* NUL + one more so we can catch
* any misformats by snprintf
...
...
@@ -95,15 +96,18 @@ VCLI_WriteResult(int fd, unsigned status, const char *result)
assert
(
status
>=
100
);
assert
(
status
<=
999
);
/*lint !e650 const out of range */
len
=
strlen
(
result
);
i
=
snprintf
(
res
,
sizeof
res
,
"%-3d %-8
jd
\n
"
,
status
,
(
intmax_t
)
strlen
(
result
)
);
"%-3d %-8
zd
\n
"
,
status
,
len
);
assert
(
i
==
CLI_LINE0_LEN
);
assert
(
strtoul
(
res
+
3
,
NULL
,
10
)
==
len
);
iov
[
0
].
iov_base
=
res
;
iov
[
0
].
iov_len
=
CLI_LINE0_LEN
;
iov
[
1
].
iov_base
=
(
void
*
)(
uintptr_t
)
result
;
/* TRUST ME */
iov
[
1
].
iov_len
=
strlen
(
result
)
;
iov
[
1
].
iov_len
=
len
;
iov
[
2
].
iov_base
=
nl
;
iov
[
2
].
iov_len
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment