Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
LSH
lsh
Commits
c48b82fc
Commit
c48b82fc
authored
Nov 18, 1998
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added workaround for broken shutdown() on linux.
Rev: src/server.c:1.23
parent
eeaa048c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
13 deletions
+19
-13
src/server.c
src/server.c
+19
-13
No files found.
src/server.c
View file @
c48b82fc
...
...
@@ -52,6 +52,20 @@
#include <sys/types.h>
#include <sys/socket.h>
/* Socket woraround */
#ifdef linux
#ifndef SHUT_RD
/* From src/linux/include/net/sock.h */
#define RCV_SHUTDOWN 1
#define SEND_SHUTDOWN 2
#define SHUT_RD RCV_SHUTDOWN
#define SHUT_WR SEND_SHUTDOWN
#define SHUT_RD_WR (RCV_SHUTDOWN | SEND_SHUTDOWN)
#endif
/* !SHUT_RD */
#endif
/* linux */
/* For debug */
#include <signal.h>
#include <unistd.h>
...
...
@@ -439,7 +453,7 @@ static void do_exit_shell(struct exit_callback *c, int signaled,
/* FIXME: Should we explicitly mark these files for closing?
* The io-backend should notice EOF anyway. */
close_fd
(
&
session
->
in
->
super
);
close_fd
(
&
session
->
in
->
super
,
0
);
#if 0
close_fd(session->out);
close_fd(session->err);
...
...
@@ -458,7 +472,7 @@ static void do_exit_shell(struct exit_callback *c, int signaled,
}
#endif
channel
->
flags
|=
CHANNEL_CLOSE_AT_E
ND_OF_FILE
;
channel
->
flags
|=
CHANNEL_CLOSE_AT_E
OF
;
if
(
!
(
channel
->
flags
&
CHANNEL_SENT_CLOSE
))
{
...
...
@@ -503,10 +517,6 @@ struct shell_request
* pipe() system call). */
static
int
make_pipe
(
int
*
fds
)
{
/* From the shutdown(2) man page */
#define REC 0
#define SEND 1
if
(
socketpair
(
AF_UNIX
,
SOCK_STREAM
,
0
,
fds
)
<
0
)
{
werror
(
"socketpair() failed: %s
\n
"
,
strerror
(
errno
));
...
...
@@ -514,22 +524,18 @@ static int make_pipe(int *fds)
}
debug
(
"Created socket pair. Using fd:s %d <-- %d
\n
"
,
fds
[
0
],
fds
[
1
]);
#if 0
if(shutdown(fds[0], SEND) < 0)
if
(
shutdown
(
fds
[
0
],
SHUT_WR
)
<
0
)
{
werror
(
"shutdown(%d, SEND) failed: %s
\n
"
,
fds
[
0
],
strerror
(
errno
));
return
0
;
}
if (shutdown(fds[1],
REC
) < 0)
if
(
shutdown
(
fds
[
1
],
SHUT_RD
)
<
0
)
{
werror
(
"shutdown(%d, REC) failed: %s
\n
"
,
fds
[
0
],
strerror
(
errno
));
return
0
;
}
#endif
return
1
;
#undef REC
#undef SEND
}
static
char
*
make_env_pair
(
char
*
name
,
struct
lsh_string
*
value
)
...
...
@@ -670,7 +676,7 @@ static int do_spawn_shell(struct channel_request *c,
close
(
err
[
0
]);
close
(
err
[
1
]);
#if
0
#if
1
execle
(
shell
,
shell
,
NULL
,
env
);
#else
#define GREETING "Hello world!\n"
...
...
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