Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
7058d471
Commit
7058d471
authored
Mar 11, 2011
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use cli_readres for varnish responses in interactive mode
parent
ef59a3c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
varnishadm.c
bin/varnishadm/varnishadm.c
+19
-13
No files found.
bin/varnishadm/varnishadm.c
View file @
7058d471
...
...
@@ -193,7 +193,9 @@ pass(int sock)
{
struct
pollfd
fds
[
2
];
char
buf
[
1024
];
int
i
,
n
,
m
;
int
i
,
n
;
char
*
answer
=
NULL
;
unsigned
u
,
status
;
#ifdef HAVE_LIBEDIT
_line_sock
=
sock
;
...
...
@@ -214,21 +216,25 @@ pass(int sock)
i
=
poll
(
fds
,
2
,
-
1
);
assert
(
i
>
0
);
if
(
fds
[
0
].
revents
&
POLLIN
)
{
n
=
read
(
fds
[
0
].
fd
,
buf
,
sizeof
buf
);
if
(
n
==
0
)
RL_EXIT
(
0
);
if
(
n
<
0
)
{
perror
(
"Read error reading CLI socket"
);
RL_EXIT
(
1
);
}
assert
(
n
>
0
);
/* Get rid of the prompt, kinda hackish */
write
(
1
,
"
\r
\r
"
,
13
);
m
=
write
(
1
,
buf
,
n
);
if
(
n
!=
m
)
{
perror
(
"Write error writing stdout"
);
u
=
write
(
1
,
"
\r
\r
"
,
13
);
u
=
cli_readres
(
fds
[
0
].
fd
,
&
status
,
&
answer
,
timeout
);
if
(
u
)
{
if
(
status
==
CLIS_COMMS
)
RL_EXIT
(
0
);
if
(
answer
)
fprintf
(
stderr
,
"%s
\n
"
,
answer
);
RL_EXIT
(
1
);
}
sprintf
(
buf
,
"%u
\n
"
,
status
);
u
=
write
(
1
,
buf
,
strlen
(
buf
));
if
(
answer
)
{
u
=
write
(
1
,
answer
,
strlen
(
answer
));
u
=
write
(
1
,
"
\n
"
,
1
);
free
(
answer
);
answer
=
NULL
;
}
#ifdef HAVE_LIBEDIT
rl_forced_update_display
();
#endif
...
...
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