Ahh, that's better
This commit is contained in:
		
							parent
							
								
									35f42464c3
								
							
						
					
					
						commit
						53791bf21d
					
				
					 3 changed files with 9 additions and 21 deletions
				
			
		|  | @ -1,3 +1,4 @@ | |||
| #include <stdio.h> | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
| #include <errno.h> | ||||
|  | @ -195,7 +196,7 @@ int patty_ax25_next_event(patty_ax25 *ax25, patty_ax25_event *ev) { | |||
|         memcpy(&ax25->unix_fds_pending_write, &ax25->unix_fds, sizeof(ax25->unix_fds)); | ||||
|         memcpy(&ax25->unix_fds_pending_error, &ax25->unix_fds, sizeof(ax25->unix_fds)); | ||||
| 
 | ||||
|         if (select(ax25->unix_fdmax + 1, | ||||
|         if (select(ax25->unix_fdmax, | ||||
|           &ax25->unix_fds_pending_read, | ||||
|           &ax25->unix_fds_pending_write, | ||||
|           &ax25->unix_fds_pending_error, | ||||
|  |  | |||
							
								
								
									
										4
									
								
								src/if.c
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								src/if.c
									
										
									
									
									
								
							|  | @ -241,8 +241,8 @@ int patty_ax25_add_if(patty_ax25 *ax25, patty_ax25_if *iface) { | |||
|     if ((fd = patty_kiss_tnc_fd_unix(iface->tnc)) >= 0) { | ||||
|         FD_SET(fd, &ax25->unix_fds); | ||||
| 
 | ||||
|         if (ax25->unix_fdmax < fd) { | ||||
|             ax25->unix_fdmax = fd; | ||||
|         if (ax25->unix_fdmax < fd + 1) { | ||||
|             ax25->unix_fdmax = fd + 1; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										21
									
								
								src/test.c
									
										
									
									
									
								
							
							
						
						
									
										21
									
								
								src/test.c
									
										
									
									
									
								
							|  | @ -35,7 +35,7 @@ int iface_callback(patty_ax25_if *iface, void *ctx) { | |||
| int main(int argc, char **argv) { | ||||
|     patty_ax25 ax25; | ||||
|     patty_ax25_if *iface; | ||||
|     int fd; | ||||
|     patty_ax25_event ev; | ||||
| 
 | ||||
|     if (argc != 2) { | ||||
|         usage(argc, argv, "No TNC device provided"); | ||||
|  | @ -65,22 +65,9 @@ int main(int argc, char **argv) { | |||
|         exit(127); | ||||
|     } | ||||
| 
 | ||||
|     if ((fd = patty_ax25_socket(&ax25)) < 0) { | ||||
|         perror("Unable to create new socket"); | ||||
| 
 | ||||
|         exit(127); | ||||
|     } | ||||
| 
 | ||||
|     if (patty_ax25_bind(&ax25, fd, "WX3RKR", 0) < 0) { | ||||
|         perror("Unable to bind socket to local address"); | ||||
| 
 | ||||
|         exit(127); | ||||
|     } | ||||
| 
 | ||||
|     if (patty_ax25_connect(&ax25, fd, "N5TX", 0) < 0) { | ||||
|         perror("Unable to connect"); | ||||
| 
 | ||||
|         exit(127); | ||||
|     if (patty_ax25_next_event(&ax25, &ev) >= 0) { | ||||
|         printf("Got event %d on fd %d\n", | ||||
|             ev.type, ev.fd); | ||||
|     } | ||||
| 
 | ||||
|     patty_ax25_stop(&ax25); | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue