summaryrefslogtreecommitdiff
path: root/src/lib/ipcp.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-04-26 14:42:05 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-04-26 14:42:05 +0200
commit6be9ae98877f23b05f69e6006036fec0f6c9d338 (patch)
tree4ff4fe417d021c67d9173b4add47c4f2b3403f30 /src/lib/ipcp.c
parenta5e2a4cb3ce7bb47ce6b0ad74f11f062bde40e1d (diff)
downloadouroboros-6be9ae98877f23b05f69e6006036fec0f6c9d338.tar.gz
ouroboros-6be9ae98877f23b05f69e6006036fec0f6c9d338.zip
lib: instance ID's are now set to the process PID
All instance-id's in ouroboros will be set by the system to the pid of the process associated with this application process instance. This means that the user has no way to choose the instance id's. Function calls that assumed manually defined instance id's have been replaced throughout the system.
Diffstat (limited to 'src/lib/ipcp.c')
-rw-r--r--src/lib/ipcp.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/lib/ipcp.c b/src/lib/ipcp.c
index b93f5488..387572b3 100644
--- a/src/lib/ipcp.c
+++ b/src/lib/ipcp.c
@@ -99,12 +99,11 @@ static ipcp_msg_t * send_recv_ipcp_msg(pid_t pid,
return recv_msg;
}
-pid_t ipcp_create(instance_name_t * api,
- enum ipcp_type ipcp_type)
+pid_t ipcp_create(char * ipcp_name,
+ enum ipcp_type ipcp_type)
{
pid_t pid = 0;
char irmd_pid[10];
- char * api_id = NULL;
size_t len = 0;
char * ipcp_dir = "bin";
char * full_name = NULL;
@@ -122,21 +121,12 @@ pid_t ipcp_create(instance_name_t * api,
return pid;
}
- api_id = malloc(n_digits(api->id) + 1);
- if (!api_id) {
- LOG_ERR("Failed to malloc");
- exit(EXIT_FAILURE);
- }
- sprintf(api_id, "%d", api->id);
-
if (ipcp_type == IPCP_NORMAL)
exec_name = IPCP_NORMAL_EXEC;
else if (ipcp_type == IPCP_SHIM_UDP)
exec_name = IPCP_SHIM_UDP_EXEC;
- else {
- free(api_id);
+ else
exit(EXIT_FAILURE);
- }
len += strlen(INSTALL_DIR);
len += strlen(ipcp_dir);
@@ -146,7 +136,6 @@ pid_t ipcp_create(instance_name_t * api,
full_name = malloc(len + 1);
if (full_name == NULL) {
LOG_ERR("Failed to malloc");
- free(api_id);
exit(EXIT_FAILURE);
}
@@ -161,8 +150,7 @@ pid_t ipcp_create(instance_name_t * api,
char * argv[] = {full_name,
irmd_pid,
- api->name,
- api_id,
+ ipcp_name,
0};
char * envp[] = {0};
@@ -172,7 +160,6 @@ pid_t ipcp_create(instance_name_t * api,
LOG_DBG("%s", strerror(errno));
LOG_ERR("Failed to load IPCP daemon");
LOG_ERR("Make sure to run the installed version");
- free(api_id);
free(full_name);
exit(EXIT_FAILURE);
}