Minor change. init now uses dup2.
-Erik
This commit is contained in:
parent
8e759aa31f
commit
a6d0dbc86f
5
init.c
5
init.c
@ -366,8 +366,9 @@ static pid_t run(char* command,
|
|||||||
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
|
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
dup(fd);
|
dup2(fd, 0);
|
||||||
dup(fd);
|
dup2(fd, 1);
|
||||||
|
dup2(fd, 2);
|
||||||
tcsetpgrp (0, getpgrp());
|
tcsetpgrp (0, getpgrp());
|
||||||
set_term(0);
|
set_term(0);
|
||||||
|
|
||||||
|
@ -366,8 +366,9 @@ static pid_t run(char* command,
|
|||||||
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
|
message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
dup(fd);
|
dup2(fd, 0);
|
||||||
dup(fd);
|
dup2(fd, 1);
|
||||||
|
dup2(fd, 2);
|
||||||
tcsetpgrp (0, getpgrp());
|
tcsetpgrp (0, getpgrp());
|
||||||
set_term(0);
|
set_term(0);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: ping.c,v 1.8 2000/01/29 05:52:40 erik Exp $
|
* $Id: ping.c,v 1.9 2000/01/29 06:29:32 erik Exp $
|
||||||
* Mini ping implementation for busybox
|
* Mini ping implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -312,14 +312,17 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
|||||||
|
|
||||||
static void ping(char *host)
|
static void ping(char *host)
|
||||||
{
|
{
|
||||||
struct protoent *proto=NULL;
|
struct protoent *proto;
|
||||||
struct hostent *h;
|
struct hostent *h;
|
||||||
char buf[MAXHOSTNAMELEN];
|
char buf[MAXHOSTNAMELEN];
|
||||||
char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
|
char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
|
||||||
int sockopt;
|
int sockopt;
|
||||||
|
|
||||||
proto = getprotobyname("icmp");
|
proto = getprotobyname("icmp");
|
||||||
if ((pingsock = socket(AF_INET, SOCK_RAW, (proto)? proto->p_proto : 1 )) < 0) { /* 1 == ICMP */
|
/* if getprotobyname failed, just silently force
|
||||||
|
* proto->p_proto to have the correct value for "icmp" */
|
||||||
|
if ((pingsock = socket(AF_INET, SOCK_RAW,
|
||||||
|
(proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
|
||||||
if (errno == EPERM) {
|
if (errno == EPERM) {
|
||||||
fprintf(stderr, "ping: permission denied. (are you root?)\n");
|
fprintf(stderr, "ping: permission denied. (are you root?)\n");
|
||||||
} else {
|
} else {
|
||||||
|
9
ping.c
9
ping.c
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: ping.c,v 1.8 2000/01/29 05:52:40 erik Exp $
|
* $Id: ping.c,v 1.9 2000/01/29 06:29:32 erik Exp $
|
||||||
* Mini ping implementation for busybox
|
* Mini ping implementation for busybox
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
|
||||||
@ -312,14 +312,17 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from)
|
|||||||
|
|
||||||
static void ping(char *host)
|
static void ping(char *host)
|
||||||
{
|
{
|
||||||
struct protoent *proto=NULL;
|
struct protoent *proto;
|
||||||
struct hostent *h;
|
struct hostent *h;
|
||||||
char buf[MAXHOSTNAMELEN];
|
char buf[MAXHOSTNAMELEN];
|
||||||
char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
|
char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN];
|
||||||
int sockopt;
|
int sockopt;
|
||||||
|
|
||||||
proto = getprotobyname("icmp");
|
proto = getprotobyname("icmp");
|
||||||
if ((pingsock = socket(AF_INET, SOCK_RAW, (proto)? proto->p_proto : 1 )) < 0) { /* 1 == ICMP */
|
/* if getprotobyname failed, just silently force
|
||||||
|
* proto->p_proto to have the correct value for "icmp" */
|
||||||
|
if ((pingsock = socket(AF_INET, SOCK_RAW,
|
||||||
|
(proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
|
||||||
if (errno == EPERM) {
|
if (errno == EPERM) {
|
||||||
fprintf(stderr, "ping: permission denied. (are you root?)\n");
|
fprintf(stderr, "ping: permission denied. (are you root?)\n");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user