Page MenuHomeFreeBSD

D38967.diff
No OneTemporary

D38967.diff

diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -134,7 +134,8 @@
struct passwd *nobody;
const char *chuser = "nobody";
char recvbuffer[MAXPKTSIZE];
- int allow_ro = 1, allow_wo = 1;
+ int allow_ro = 1, allow_wo = 1, on = 1;
+ pid_t pid;
tzset(); /* syslog in localtime */
acting_as_client = 0;
@@ -222,12 +223,9 @@
umask(mask);
- {
- int on = 1;
- if (ioctl(0, FIONBIO, &on) < 0) {
- tftp_log(LOG_ERR, "ioctl(FIONBIO): %s", strerror(errno));
- exit(1);
- }
+ if (ioctl(0, FIONBIO, &on) < 0) {
+ tftp_log(LOG_ERR, "ioctl(FIONBIO): %s", strerror(errno));
+ exit(1);
}
/* Find out who we are talking to and what we are going to do */
@@ -255,40 +253,14 @@
* break before doing the above "recvfrom", inetd would
* spawn endless instances, clogging the system.
*/
- {
- int i, pid;
-
- for (i = 1; i < 20; i++) {
- pid = fork();
- if (pid < 0) {
- sleep(i);
- /*
- * flush out to most recently sent request.
- *
- * This may drop some request, but those
- * will be resent by the clients when
- * they timeout. The positive effect of
- * this flush is to (try to) prevent more
- * than one tftpd being started up to service
- * a single request from a single client.
- */
- peerlen = sizeof peer_sock;
- i = recvfrom(0, recvbuffer, MAXPKTSIZE, 0,
- (struct sockaddr *)&peer_sock, &peerlen);
- if (i > 0) {
- n = i;
- }
- } else {
- break;
- }
- }
- if (pid < 0) {
- tftp_log(LOG_ERR, "fork: %s", strerror(errno));
- exit(1);
- } else if (pid != 0) {
- exit(0);
- }
+ pid = fork();
+ if (pid < 0) {
+ tftp_log(LOG_ERR, "fork: %s", strerror(errno));
+ exit(1);
+ } else if (pid != 0) {
+ exit(0);
}
+ /* child */
#ifdef LIBWRAP
/*

File Metadata

Mime Type
text/plain
Expires
Thu, Feb 6, 4:40 AM (22 h, 11 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16487124
Default Alt Text
D38967.diff (1 KB)

Event Timeline