aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2019-09-17 12:59:21 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2019-09-17 12:59:21 +0200
commitaf9b05358b9e2715935ab79aa29c0056937370ad (patch)
tree1261b6761f9ba94764e8aaca3889e8330fea4282 /src
parenteda842cbb639c80731ea23b6436ae958ada39848 (diff)
downloadbbs-af9b05358b9e2715935ab79aa29c0056937370ad.tar.gz
minor fixes in modem.c
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
-rw-r--r--src/modem.c23
2 files changed, 6 insertions, 23 deletions
diff --git a/src/main.c b/src/main.c
index 2a76f0f..f4318b9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -246,7 +246,7 @@ void telnet_server(struct prog_params params)
int server_socket, client_socket;
struct sockaddr_in socket_address, client_address;
- size_t claddrsize = sizeof(client_address);
+ socklen_t claddrsize = sizeof(client_address);
if ( (server_socket = socket(AF_INET, SOCK_STREAM, 0)) == -1 )
{
@@ -259,7 +259,7 @@ void telnet_server(struct prog_params params)
socket_address.sin_family = AF_INET;
socket_address.sin_port = htons( params.port );
- if ( (bind(server_socket, &socket_address, sizeof(socket_address))) == -1 )
+ if ( (bind(server_socket, (struct sockaddr*) &socket_address, sizeof(socket_address))) == -1 )
{
printf("Error binding socket: %i: %s\n", errno, strerror(errno));
exit(1);
@@ -273,7 +273,7 @@ void telnet_server(struct prog_params params)
while(1)
{
- client_socket = accept(server_socket, &client_address, &claddrsize);
+ client_socket = accept(server_socket, (struct sockaddr*)&client_address, &claddrsize);
DEBUG_PRINTF("Connection: %s\n", inet_ntoa(client_address.sin_addr));
handle_connection(client_socket, client_address, params.run_argc, params.run_argv);
}
diff --git a/src/modem.c b/src/modem.c
index 9f79ee2..5b0daba 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -129,26 +129,6 @@ int modem_run(int fd, int argc, char* argv[])
pid_t pid = fork_run(in[0], out[1], out[1], argc, argv);//fork();
-/* if(pid == 0) {//child
- close (in[1]);
- close (out[0]);
-
- dup2 (in[0], STDIN_FILENO);
- dup2 (out[1], STDOUT_FILENO);
- dup2 (out[1], STDERR_FILENO);
-
- char* arv[argc + 1];
-
- for(int i = 0; i < argc; i++)
- arv[i] = argv[i];
-
- arv[argc] = NULL;
-
- execv(argv[0], arv);
-
- printf("EXEC ERROR %i: %s\r\n", errno, strerror(errno));
- exit(1);
- }*/
if (pid < 0) {//error
return 2;
}
@@ -204,6 +184,9 @@ int modem_run(int fd, int argc, char* argv[])
}
}
+ if(ret < 0)
+ break;
+
if(kill(pid,0)) //Check if child is still alive, if not return.
break;
}