Changed the read() call into a recv() call with a flag of NOSIGNAL since I
don't want signals messing up my calling conventions.
This commit is contained in:
		
							parent
							
								
									99488cbd5e
								
							
						
					
					
						commit
						dde4e9adcc
					
				
							
								
								
									
										12
									
								
								src/sock.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/sock.c
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
				
			|||||||
/* $Id: sock.c,v 1.14 2001-10-25 05:10:32 rjkaes Exp $
 | 
					/* $Id: sock.c,v 1.15 2001-11-12 21:10:51 rjkaes Exp $
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Sockets are created and destroyed here. When a new connection comes in from
 | 
					 * Sockets are created and destroyed here. When a new connection comes in from
 | 
				
			||||||
 * a client, we need to copy the socket and the create a second socket to the
 | 
					 * a client, we need to copy the socket and the create a second socket to the
 | 
				
			||||||
@ -259,18 +259,22 @@ ssize_t readline(int fd, char *ptr, size_t maxlen)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	for (n = 1; n < maxlen; n++) {
 | 
						for (n = 1; n < maxlen; n++) {
 | 
				
			||||||
	again:
 | 
						again:
 | 
				
			||||||
		if ((rc = read(fd, &c, 1)) == 1) {
 | 
							if ((rc = recv(fd, &c, 1, MSG_NOSIGNAL)) == 1) {
 | 
				
			||||||
			*ptr++ = c;
 | 
								*ptr++ = c;
 | 
				
			||||||
			if (c == '\n')
 | 
								if (c == '\n')
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
		} else if (rc == 0) {
 | 
							} else if (rc == 0) {
 | 
				
			||||||
			if (n == 1)
 | 
								if (n == 1) {
 | 
				
			||||||
 | 
									DEBUG2("File_Desc: %d Closed.", fd);
 | 
				
			||||||
				return 0;
 | 
									return 0;
 | 
				
			||||||
			else
 | 
								} else
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			if (errno == EINTR)
 | 
								if (errno == EINTR)
 | 
				
			||||||
				goto again;
 | 
									goto again;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								DEBUG2("File_Desc: %d \"%s\" (%d)", fd, strerror(errno), errno);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			return -1;
 | 
								return -1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user