projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add platform tweaks
[oweals/busybox.git]
/
networking
/
slattach.c
diff --git
a/networking/slattach.c
b/networking/slattach.c
index e501d82e1d42df6ca8329b2c5b89aaef2e71ff0d..d3212bb40d845b9f23c086256c4036a44f73320c 100644
(file)
--- a/
networking/slattach.c
+++ b/
networking/slattach.c
@@
-25,7
+25,7
@@
struct globals {
#define handle (G.handle )
#define saved_disc (G.saved_disc )
#define saved_state (G.saved_state )
#define handle (G.handle )
#define saved_disc (G.saved_disc )
#define saved_state (G.saved_state )
-#define INIT_G() do {} while (0)
+#define INIT_G() do {
} while (0)
/*
/*
@@
-43,7
+43,7
@@
static void save_state(void)
xioctl(handle, TIOCGETD, &saved_disc);
}
xioctl(handle, TIOCGETD, &saved_disc);
}
-static int set_termios_state_
and
_warn(struct termios *state)
+static int set_termios_state_
or
_warn(struct termios *state)
{
int ret;
{
int ret;
@@
-64,7
+64,7
@@
static int set_termios_state_and_warn(struct termios *state)
* Go on after errors: we want to restore as many controlled ttys
* as possible.
*/
* Go on after errors: we want to restore as many controlled ttys
* as possible.
*/
-static void restore_state_and_exit(int exitcode)
ATTRIBUTE_
NORETURN;
+static void restore_state_and_exit(int exitcode) NORETURN;
static void restore_state_and_exit(int exitcode)
{
struct termios state;
static void restore_state_and_exit(int exitcode)
{
struct termios state;
@@
-78,12
+78,12
@@
static void restore_state_and_exit(int exitcode)
memcpy(&state, &saved_state, sizeof(state));
cfsetispeed(&state, B0);
cfsetospeed(&state, B0);
memcpy(&state, &saved_state, sizeof(state));
cfsetispeed(&state, B0);
cfsetospeed(&state, B0);
- if (set_termios_state_
and
_warn(&state))
+ if (set_termios_state_
or
_warn(&state))
exitcode = 1;
sleep(1);
/* Restore line status */
exitcode = 1;
sleep(1);
/* Restore line status */
- if (set_termios_state_
and
_warn(&saved_state))
+ if (set_termios_state_
or
_warn(&saved_state))
exit(EXIT_FAILURE);
if (ENABLE_FEATURE_CLEAN_UP)
close(handle);
exit(EXIT_FAILURE);
if (ENABLE_FEATURE_CLEAN_UP)
close(handle);
@@
-99,7
+99,7
@@
static void set_state(struct termios *state, int encap)
int disc;
/* Set line status */
int disc;
/* Set line status */
- if (set_termios_state_
and
_warn(state))
+ if (set_termios_state_
or
_warn(state))
goto bad;
/* Set line discliple (N_SLIP always) */
disc = N_SLIP;
goto bad;
/* Set line discliple (N_SLIP always) */
disc = N_SLIP;
@@
-110,17
+110,17
@@
static void set_state(struct termios *state, int encap)
/* Set encapsulation (SLIP, CSLIP, etc) */
if (ioctl_or_warn(handle, SIOCSIFENCAP, &encap) < 0) {
bad:
/* Set encapsulation (SLIP, CSLIP, etc) */
if (ioctl_or_warn(handle, SIOCSIFENCAP, &encap) < 0) {
bad:
- restore_state_and_exit(
1
);
+ restore_state_and_exit(
EXIT_FAILURE
);
}
}
}
}
-static void sig_handler(int signo)
+static void sig_handler(int signo
UNUSED_PARAM
)
{
{
- restore_state_and_exit(
0
);
+ restore_state_and_exit(
EXIT_SUCCESS
);
}
int slattach_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
}
int slattach_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int slattach_main(int argc, char **argv)
+int slattach_main(int argc
UNUSED_PARAM
, char **argv)
{
/* Line discipline code table */
static const char proto_names[] ALIGN1 =
{
/* Line discipline code table */
static const char proto_names[] ALIGN1 =
@@
-206,6
+206,8
@@
int slattach_main(int argc, char **argv)
state.c_cflag = CS8 | HUPCL | CREAD
| ((opt & OPT_L_local) ? CLOCAL : 0)
| ((opt & OPT_F_noflow) ? 0 : CRTSCTS);
state.c_cflag = CS8 | HUPCL | CREAD
| ((opt & OPT_L_local) ? CLOCAL : 0)
| ((opt & OPT_F_noflow) ? 0 : CRTSCTS);
+ cfsetispeed(&state, cfgetispeed(&saved_state));
+ cfsetospeed(&state, cfgetospeed(&saved_state));
}
if (opt & OPT_s_baud) {
}
if (opt & OPT_s_baud) {
@@
-239,5
+241,5
@@
int slattach_main(int argc, char **argv)
system(extcmd);
/* Restore states and exit */
system(extcmd);
/* Restore states and exit */
- restore_state_and_exit(
0
);
+ restore_state_and_exit(
EXIT_SUCCESS
);
}
}