diff options
| author | Erik Andersen <andersen@codepoet.org> | 2000-01-29 06:29:32 +0000 |
|---|---|---|
| committer | Erik Andersen <andersen@codepoet.org> | 2000-01-29 06:29:32 +0000 |
| commit | a6d0dbc86fd8a84f9c2a05f77013bd3eb5efa697 (patch) | |
| tree | 084110d01c73b978088256492695d90fb7d52ef0 | |
| parent | 8e759aa31fa3f0dea6686cb7194398e68ff76696 (diff) | |
| download | busybox-w32-a6d0dbc86fd8a84f9c2a05f77013bd3eb5efa697.tar.gz busybox-w32-a6d0dbc86fd8a84f9c2a05f77013bd3eb5efa697.tar.bz2 busybox-w32-a6d0dbc86fd8a84f9c2a05f77013bd3eb5efa697.zip | |
Minor change. init now uses dup2.
-Erik
| -rw-r--r-- | init.c | 5 | ||||
| -rw-r--r-- | init/init.c | 5 | ||||
| -rw-r--r-- | networking/ping.c | 9 | ||||
| -rw-r--r-- | ping.c | 9 |
4 files changed, 18 insertions, 10 deletions
| @@ -366,8 +366,9 @@ static pid_t run(char* command, | |||
| 366 | message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal); | 366 | message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal); |
| 367 | exit(1); | 367 | exit(1); |
| 368 | } | 368 | } |
| 369 | dup(fd); | 369 | dup2(fd, 0); |
| 370 | dup(fd); | 370 | dup2(fd, 1); |
| 371 | dup2(fd, 2); | ||
| 371 | tcsetpgrp (0, getpgrp()); | 372 | tcsetpgrp (0, getpgrp()); |
| 372 | set_term(0); | 373 | set_term(0); |
| 373 | 374 | ||
diff --git a/init/init.c b/init/init.c index dd92854b4..722ccd217 100644 --- a/init/init.c +++ b/init/init.c | |||
| @@ -366,8 +366,9 @@ static pid_t run(char* command, | |||
| 366 | message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal); | 366 | message(LOG|CONSOLE, "Bummer, can't open %s\r\n", terminal); |
| 367 | exit(1); | 367 | exit(1); |
| 368 | } | 368 | } |
| 369 | dup(fd); | 369 | dup2(fd, 0); |
| 370 | dup(fd); | 370 | dup2(fd, 1); |
| 371 | dup2(fd, 2); | ||
| 371 | tcsetpgrp (0, getpgrp()); | 372 | tcsetpgrp (0, getpgrp()); |
| 372 | set_term(0); | 373 | set_term(0); |
| 373 | 374 | ||
diff --git a/networking/ping.c b/networking/ping.c index 5cadac3e8..5b680195a 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: ping.c,v 1.8 2000/01/29 05:52:40 erik Exp $ | 2 | * $Id: ping.c,v 1.9 2000/01/29 06:29:32 erik Exp $ |
| 3 | * Mini ping implementation for busybox | 3 | * Mini ping implementation for busybox |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 5 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
| @@ -312,14 +312,17 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
| 312 | 312 | ||
| 313 | static void ping(char *host) | 313 | static void ping(char *host) |
| 314 | { | 314 | { |
| 315 | struct protoent *proto=NULL; | 315 | struct protoent *proto; |
| 316 | struct hostent *h; | 316 | struct hostent *h; |
| 317 | char buf[MAXHOSTNAMELEN]; | 317 | char buf[MAXHOSTNAMELEN]; |
| 318 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; | 318 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; |
| 319 | int sockopt; | 319 | int sockopt; |
| 320 | 320 | ||
| 321 | proto = getprotobyname("icmp"); | 321 | proto = getprotobyname("icmp"); |
| 322 | if ((pingsock = socket(AF_INET, SOCK_RAW, (proto)? proto->p_proto : 1 )) < 0) { /* 1 == ICMP */ | 322 | /* if getprotobyname failed, just silently force |
| 323 | * proto->p_proto to have the correct value for "icmp" */ | ||
| 324 | if ((pingsock = socket(AF_INET, SOCK_RAW, | ||
| 325 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ | ||
| 323 | if (errno == EPERM) { | 326 | if (errno == EPERM) { |
| 324 | fprintf(stderr, "ping: permission denied. (are you root?)\n"); | 327 | fprintf(stderr, "ping: permission denied. (are you root?)\n"); |
| 325 | } else { | 328 | } else { |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * $Id: ping.c,v 1.8 2000/01/29 05:52:40 erik Exp $ | 2 | * $Id: ping.c,v 1.9 2000/01/29 06:29:32 erik Exp $ |
| 3 | * Mini ping implementation for busybox | 3 | * Mini ping implementation for busybox |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> | 5 | * Copyright (C) 1999 by Randolph Chung <tausq@debian.org> |
| @@ -312,14 +312,17 @@ static void unpack(char *buf, int sz, struct sockaddr_in *from) | |||
| 312 | 312 | ||
| 313 | static void ping(char *host) | 313 | static void ping(char *host) |
| 314 | { | 314 | { |
| 315 | struct protoent *proto=NULL; | 315 | struct protoent *proto; |
| 316 | struct hostent *h; | 316 | struct hostent *h; |
| 317 | char buf[MAXHOSTNAMELEN]; | 317 | char buf[MAXHOSTNAMELEN]; |
| 318 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; | 318 | char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; |
| 319 | int sockopt; | 319 | int sockopt; |
| 320 | 320 | ||
| 321 | proto = getprotobyname("icmp"); | 321 | proto = getprotobyname("icmp"); |
| 322 | if ((pingsock = socket(AF_INET, SOCK_RAW, (proto)? proto->p_proto : 1 )) < 0) { /* 1 == ICMP */ | 322 | /* if getprotobyname failed, just silently force |
| 323 | * proto->p_proto to have the correct value for "icmp" */ | ||
| 324 | if ((pingsock = socket(AF_INET, SOCK_RAW, | ||
| 325 | (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ | ||
| 323 | if (errno == EPERM) { | 326 | if (errno == EPERM) { |
| 324 | fprintf(stderr, "ping: permission denied. (are you root?)\n"); | 327 | fprintf(stderr, "ping: permission denied. (are you root?)\n"); |
| 325 | } else { | 328 | } else { |
