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
c39ed3c8
Commit
c39ed3c8
authored
Jan 13, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make pty ctrl-terminal to get SIGHUPs
parent
586dda05
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
+17
-16
vtc_process.c
bin/varnishtest/vtc_process.c
+17
-16
No files found.
bin/varnishtest/vtc_process.c
View file @
c39ed3c8
...
@@ -390,29 +390,31 @@ process_start(struct process *p)
...
@@ -390,29 +390,31 @@ process_start(struct process *p)
AZ
(
unlockpt
(
master
));
AZ
(
unlockpt
(
master
));
slavename
=
ptsname
(
master
);
slavename
=
ptsname
(
master
);
AN
(
slavename
);
AN
(
slavename
);
slave
=
open
(
slavename
,
O_RDWR
);
assert
(
slave
>=
0
);
#ifdef __sun
if
(
ioctl
(
slave
,
I_PUSH
,
"ptem"
))
vtc_log
(
p
->
vl
,
4
,
"PUSH ptem: %s"
,
strerror
(
errno
));
if
(
ioctl
(
slave
,
I_PUSH
,
"ldterm"
))
vtc_log
(
p
->
vl
,
4
,
"PUSH ldterm: %s"
,
strerror
(
errno
));
#endif
process_init_term
(
p
,
slave
);
AZ
(
pipe
(
fd2
));
AZ
(
pipe
(
fd2
));
p
->
pid
=
fork
();
p
->
pid
=
fork
();
assert
(
p
->
pid
>=
0
);
assert
(
p
->
pid
>=
0
);
if
(
p
->
pid
==
0
)
{
if
(
p
->
pid
==
0
)
{
AZ
(
setenv
(
"TERM"
,
"ansi.sys"
,
1
));
setsid
();
AZ
(
unsetenv
(
"TERMCAP"
));
assert
(
dup2
(
slave
,
STDIN_FILENO
)
==
STDIN_FILENO
);
assert
(
dup2
(
slave
,
STDOUT_FILENO
)
==
STDOUT_FILENO
);
assert
(
dup2
(
fd2
[
1
],
STDERR_FILENO
)
==
STDERR_FILENO
);
assert
(
dup2
(
fd2
[
1
],
STDERR_FILENO
)
==
STDERR_FILENO
);
close
(
STDIN_FILENO
);
slave
=
open
(
slavename
,
O_RDWR
);
assert
(
slave
==
STDIN_FILENO
);
AZ
(
ioctl
(
STDIN_FILENO
,
TIOCSCTTY
,
0
));
close
(
STDOUT_FILENO
);
assert
(
dup2
(
slave
,
STDOUT_FILENO
)
==
STDOUT_FILENO
);
VSUB_closefrom
(
STDERR_FILENO
+
1
);
VSUB_closefrom
(
STDERR_FILENO
+
1
);
AZ
(
setpgid
(
0
,
0
));
#ifdef __sun
if
(
ioctl
(
slave
,
I_PUSH
,
"ptem"
))
vtc_log
(
p
->
vl
,
4
,
"PUSH ptem: %s"
,
strerror
(
errno
));
if
(
ioctl
(
slave
,
I_PUSH
,
"ldterm"
))
vtc_log
(
p
->
vl
,
4
,
"PUSH ldterm: %s"
,
strerror
(
errno
));
#endif
process_init_term
(
p
,
slave
);
AZ
(
setenv
(
"TERM"
,
"ansi.sys"
,
1
));
AZ
(
unsetenv
(
"TERMCAP"
));
// Not using NULL because GCC is now even more demented...
// Not using NULL because GCC is now even more demented...
AZ
(
execl
(
"/bin/sh"
,
"/bin/sh"
,
"-c"
,
VSB_data
(
cl
),
(
char
*
)
0
));
AZ
(
execl
(
"/bin/sh"
,
"/bin/sh"
,
"-c"
,
VSB_data
(
cl
),
(
char
*
)
0
));
exit
(
1
);
exit
(
1
);
...
@@ -420,7 +422,6 @@ process_start(struct process *p)
...
@@ -420,7 +422,6 @@ process_start(struct process *p)
vtc_log
(
p
->
vl
,
3
,
"PID: %ld"
,
(
long
)
p
->
pid
);
vtc_log
(
p
->
vl
,
3
,
"PID: %ld"
,
(
long
)
p
->
pid
);
VSB_destroy
(
&
cl
);
VSB_destroy
(
&
cl
);
closefd
(
&
slave
);
p
->
fd_term
=
master
;
p
->
fd_term
=
master
;
closefd
(
&
fd2
[
1
]);
closefd
(
&
fd2
[
1
]);
p
->
fd_stderr
=
fd2
[
0
];
p
->
fd_stderr
=
fd2
[
0
];
...
...
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