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
0a23fd62
Commit
0a23fd62
authored
Mar 11, 2011
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add terminal reset call to libedit when exiting
parent
281c8187
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
varnishadm.c
bin/varnishadm/varnishadm.c
+22
-8
No files found.
bin/varnishadm/varnishadm.c
View file @
0a23fd62
...
...
@@ -50,6 +50,16 @@ SVNID("$Id$")
#include "varnishapi.h"
#include "vss.h"
#ifdef HAVE_LIBEDIT
#define RL_EXIT(status) \
do { \
rl_callback_handler_remove(); \
exit(status); \
} while (0);
#else
#define RL_EXIT(status) exit(status);
#endif
static
double
timeout
=
5
;
static
void
...
...
@@ -62,7 +72,7 @@ cli_write(int sock, const char *s)
if
(
i
==
l
)
return
;
perror
(
"Write error CLI socket"
);
exit
(
1
);
RL_EXIT
(
1
);
}
/*
...
...
@@ -164,9 +174,13 @@ do_args(int sock, int argc, char * const *argv)
static
int
_line_sock
;
void
send_line
(
char
*
l
)
{
cli_write
(
_line_sock
,
l
);
cli_write
(
_line_sock
,
"
\n
"
);
add_history
(
l
);
if
(
l
)
{
cli_write
(
_line_sock
,
l
);
cli_write
(
_line_sock
,
"
\n
"
);
add_history
(
l
);
}
else
{
RL_EXIT
(
0
);
}
}
#endif
...
...
@@ -202,10 +216,10 @@ pass(int sock)
if
(
fds
[
0
].
revents
&
POLLIN
)
{
n
=
read
(
fds
[
0
].
fd
,
buf
,
sizeof
buf
);
if
(
n
==
0
)
exit
(
0
);
RL_EXIT
(
0
);
if
(
n
<
0
)
{
perror
(
"Read error reading CLI socket"
);
exit
(
0
);
RL_EXIT
(
1
);
}
assert
(
n
>
0
);
/* Get rid of the prompt, kinda hackish */
...
...
@@ -213,7 +227,7 @@ pass(int sock)
m
=
write
(
1
,
buf
,
n
);
if
(
n
!=
m
)
{
perror
(
"Write error writing stdout"
);
exit
(
1
);
RL_EXIT
(
1
);
}
#ifdef HAVE_LIBEDIT
rl_forced_update_display
();
...
...
@@ -228,7 +242,7 @@ pass(int sock)
AZ
(
shutdown
(
sock
,
SHUT_WR
));
fds
[
1
].
fd
=
-
1
;
}
else
if
(
n
<
0
)
{
exit
(
0
);
RL_EXIT
(
0
);
}
else
{
buf
[
n
]
=
'\0'
;
cli_write
(
sock
,
buf
);
...
...
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