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
b530ed43
Commit
b530ed43
authored
Mar 11, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://git.varnish-cache.org/git/varnish-cache
parents
1ebd8615
7058d471
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
+21
-15
varnishadm.c
bin/varnishadm/varnishadm.c
+21
-15
No files found.
bin/varnishadm/varnishadm.c
View file @
b530ed43
...
...
@@ -55,9 +55,9 @@ SVNID("$Id$")
do { \
rl_callback_handler_remove(); \
exit(status); \
} while (0)
;
} while (0)
#else
#define RL_EXIT(status) exit(status)
;
#define RL_EXIT(status) exit(status)
#endif
static
double
timeout
=
5
;
...
...
@@ -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