summaryrefslogtreecommitdiff
path: root/src/tools/irm/irm_bind_api.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-08-31 14:30:28 +0200
committerdimitri staessens <[email protected]>2016-08-31 14:31:07 +0200
commitc1f31f6c3ca8bd91d0caaa209e2a1592eebf77d5 (patch)
tree64ca0980ac2f8e19cc945d0932c59daec99e3210 /src/tools/irm/irm_bind_api.c
parent857c014a40a75eda574af8b2002b1c794bc0975c (diff)
downloadouroboros-c1f31f6c3ca8bd91d0caaa209e2a1592eebf77d5.tar.gz
ouroboros-c1f31f6c3ca8bd91d0caaa209e2a1592eebf77d5.zip
tools, irm: Fix segfault with missing parameters
Diffstat (limited to 'src/tools/irm/irm_bind_api.c')
-rw-r--r--src/tools/irm/irm_bind_api.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/irm/irm_bind_api.c b/src/tools/irm/irm_bind_api.c
index b21d305c..abc21b3d 100644
--- a/src/tools/irm/irm_bind_api.c
+++ b/src/tools/irm/irm_bind_api.c
@@ -40,7 +40,7 @@ int do_bind_api(int argc, char ** argv)
pid_t api = -1;
char * name = NULL;
- while (argc > 0) {
+ while (argc > 1) {
if (matches(*argv, "name") == 0) {
name = *(argv + 1);
++argv;
@@ -59,7 +59,7 @@ int do_bind_api(int argc, char ** argv)
--argc;
}
- if (api < 0 || name == NULL) {
+ if (argc == 1 || api < 0 || name == NULL) {
usage();
return -1;
}