summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-08-29 16:50:26 +0000
committerdimitri staessens <dimitri.staessens@ugent.be>2017-08-29 16:50:26 +0000
commit8fe0340d2117cf9b5c724ff10621978ef2bee5f1 (patch)
tree8158e5feb1e59546ba1f972286f84ba7532c6615
parentf3593b8a26c05392b09c16472b55f8662db22335 (diff)
parente533ca60b841193fbdb7d135de3d9e56916445c2 (diff)
downloadouroboros-8fe0340d2117cf9b5c724ff10621978ef2bee5f1.tar.gz
ouroboros-8fe0340d2117cf9b5c724ff10621978ef2bee5f1.zip
Merged in sandervrijders/ouroboros/be-corrupt (pull request #581)
Be corrupt
-rw-r--r--include/ouroboros/shm_rdrbuff.h2
-rw-r--r--src/irmd/main.c2
-rw-r--r--src/lib/shm_rdrbuff.c12
-rw-r--r--src/tools/irm/irm.c2
-rw-r--r--src/tools/irm/irm_ipcp.c3
-rw-r--r--src/tools/irm/irm_ipcp_connect.c12
-rw-r--r--src/tools/irm/irm_ipcp_disconnect.c12
7 files changed, 30 insertions, 15 deletions
diff --git a/include/ouroboros/shm_rdrbuff.h b/include/ouroboros/shm_rdrbuff.h
index 079c11b2..29410ac3 100644
--- a/include/ouroboros/shm_rdrbuff.h
+++ b/include/ouroboros/shm_rdrbuff.h
@@ -41,6 +41,8 @@ void shm_rdrbuff_close(struct shm_rdrbuff * rdrb);
void shm_rdrbuff_destroy(struct shm_rdrbuff * rdrb);
+void shm_rdrbuff_purge(void);
+
int shm_rdrbuff_wait_full(struct shm_rdrbuff * rdrb,
struct timespec * timeo);
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 1d62de85..c5caff6c 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -2204,7 +2204,7 @@ static int irm_init(void)
if (kill(lockfile_owner(irmd.lf), 0) < 0) {
log_info("IRMd didn't properly shut down last time.");
- shm_rdrbuff_destroy(shm_rdrbuff_open());
+ shm_rdrbuff_purge();
log_info("Stale resources cleaned.");
lockfile_destroy(irmd.lf);
irmd.lf = lockfile_create();
diff --git a/src/lib/shm_rdrbuff.c b/src/lib/shm_rdrbuff.c
index d8893677..a3333a35 100644
--- a/src/lib/shm_rdrbuff.c
+++ b/src/lib/shm_rdrbuff.c
@@ -323,6 +323,18 @@ void shm_rdrbuff_close(struct shm_rdrbuff * rdrb)
free(rdrb);
}
+void shm_rdrbuff_purge(void)
+{
+ char * shm_rdrb_fn;
+
+ shm_rdrb_fn = rdrb_filename();
+ if (shm_rdrb_fn == NULL)
+ return;
+
+ shm_unlink(shm_rdrb_fn);
+ free(shm_rdrb_fn);
+}
+
void shm_rdrbuff_destroy(struct shm_rdrbuff * rdrb)
{
char * shm_rdrb_fn;
diff --git a/src/tools/irm/irm.c b/src/tools/irm/irm.c
index 4e275e48..a77f9b7b 100644
--- a/src/tools/irm/irm.c
+++ b/src/tools/irm/irm.c
@@ -34,7 +34,7 @@ static void usage(void)
{
printf("Usage: irm [OPERATION]\n\n"
"where OPERATION = {ipcp bind unbind\n"
- " register unregister\n");
+ " register unregister}\n");
}
static int do_help(int argc, char **argv)
diff --git a/src/tools/irm/irm_ipcp.c b/src/tools/irm/irm_ipcp.c
index 2f7b01c9..fb1a66b9 100644
--- a/src/tools/irm/irm_ipcp.c
+++ b/src/tools/irm/irm_ipcp.c
@@ -29,7 +29,8 @@ static void usage(void)
{
printf("Usage: irm ipcp [OPERATION]\n\n"
"where OPERATION = {create destroy\n"
- " bootstrap enroll help}\n");
+ " bootstrap enroll\n"
+ " connect disconnect help}\n");
}
static int do_help(int argc, char **argv)
diff --git a/src/tools/irm/irm_ipcp_connect.c b/src/tools/irm/irm_ipcp_connect.c
index 168c8d17..3f52e6f8 100644
--- a/src/tools/irm/irm_ipcp_connect.c
+++ b/src/tools/irm/irm_ipcp_connect.c
@@ -35,10 +35,10 @@
static void usage(void)
{
printf("Usage: irm ipcp connect\n"
- " name <ipcp name>\n"
- " comp <COMPONENT>\n"
- " dst <name of destination IPCP>\n"
- "where COMPONENT = {" DT " " MGMT "},\n\n");
+ " name <ipcp name>\n"
+ " component [COMPONENT]\n"
+ " dst <name of destination IPCP>\n\n"
+ "where COMPONENT = {" DT " " MGMT "}\n");
}
int do_connect_ipcp(int argc,
@@ -51,11 +51,11 @@ int do_connect_ipcp(int argc,
ssize_t len = 0;
while (argc > 0) {
- if (strcmp(*argv, "name") == 0) {
+ if (matches(*argv, "name") == 0) {
name = *(argv + 1);
} else if (matches(*argv, "dst") == 0) {
dst_name = *(argv + 1);
- } else if (matches(*argv, "comp") == 0) {
+ } else if (matches(*argv, "component") == 0) {
comp_name = *(argv + 1);
} else {
printf("\"%s\" is unknown, try \"irm "
diff --git a/src/tools/irm/irm_ipcp_disconnect.c b/src/tools/irm/irm_ipcp_disconnect.c
index 8f83f3e8..2a4bbd38 100644
--- a/src/tools/irm/irm_ipcp_disconnect.c
+++ b/src/tools/irm/irm_ipcp_disconnect.c
@@ -35,10 +35,10 @@
static void usage(void)
{
printf("Usage: irm ipcp disconnect\n"
- " name <ipcp name>\n"
- " comp <COMPONENT>\n"
- " dst <name of destination IPCP>\n"
- "where COMPONENT = {" DT " " MGMT "},\n\n");
+ " name <ipcp name>\n"
+ " component [COMPONENT]\n"
+ " dst <name of destination IPCP>\n\n"
+ "where COMPONENT = {" DT " " MGMT "}\n");
}
int do_disconnect_ipcp(int argc,
@@ -51,11 +51,11 @@ int do_disconnect_ipcp(int argc,
ssize_t len = 0;
while (argc > 0) {
- if (strcmp(*argv, "name") == 0) {
+ if (matches(*argv, "name") == 0) {
name = *(argv + 1);
} else if (matches(*argv, "dst") == 0) {
dst_name = *(argv + 1);
- } else if (matches(*argv, "comp") == 0) {
+ } else if (matches(*argv, "component") == 0) {
comp_name = *(argv + 1);
} else {
printf("\"%s\" is unknown, try \"irm "