Implement patty_ax25_socket()
This commit is contained in:
parent
87ec27dd92
commit
c17abcf77a
1 changed files with 22 additions and 0 deletions
22
src/ax25.c
22
src/ax25.c
|
@ -65,3 +65,25 @@ error_dict_set:
|
|||
error_get_if:
|
||||
return -1;
|
||||
}
|
||||
|
||||
int patty_ax25_socket(patty_ax25 *ax25) {
|
||||
patty_ax25_sock *sock;
|
||||
|
||||
if ((sock = malloc(sizeof(*sock))) == NULL) {
|
||||
goto error_malloc_sock;
|
||||
}
|
||||
|
||||
memset(sock, '\0', sizeof(*sock));
|
||||
|
||||
if (patty_dict_set(ax25->fd_lookup, &ax25->fd, sizeof(ax25->fd), sock) == NULL) {
|
||||
goto error_dict_set;
|
||||
}
|
||||
|
||||
return ax25->fd++;
|
||||
|
||||
error_dict_set:
|
||||
free(sock);
|
||||
|
||||
error_malloc_sock:
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue