summaryrefslogtreecommitdiff
path: root/src/tools/irm
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-07-03 15:56:03 +0200
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-07-03 15:56:03 +0200
commitd6449cd5ecc6a557eb25c9ed2048e3aa652da629 (patch)
tree2dfdf933694cd6c6c74d9b6d8c4fc7d69b3aa450 /src/tools/irm
parentd2a7cb2d27dab595bd2948ad3724016ca948e61e (diff)
parent9a255c8ff98815cc1c6d0b39c19e8ee2afbb587c (diff)
downloadouroboros-d6449cd5ecc6a557eb25c9ed2048e3aa652da629.tar.gz
ouroboros-d6449cd5ecc6a557eb25c9ed2048e3aa652da629.zip
Merged in dstaesse/ouroboros/be-bind (pull request #149)
irmd, tools: checks on binary
Diffstat (limited to 'src/tools/irm')
-rw-r--r--src/tools/irm/irm_bind.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/irm/irm_bind.c b/src/tools/irm/irm_bind.c
index 85e5bd3d..92ebdd8a 100644
--- a/src/tools/irm/irm_bind.c
+++ b/src/tools/irm/irm_bind.c
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <string.h>
+#include <sys/stat.h>
#include <ouroboros/irm.h>
@@ -44,6 +45,7 @@ int do_bind(int argc, char ** argv)
char * name = NULL;
char * ap_name = NULL;
uint16_t flags = 0;
+ struct stat s;
while (argc > 0) {
if (matches(*argv, "name") == 0) {
@@ -77,5 +79,15 @@ int do_bind(int argc, char ** argv)
return -1;
}
+ if (stat(ap_name, &s) != 0) {
+ printf("Application %s does not exist.\n", ap_name);
+ return -1;
+ }
+
+ if (!(s.st_mode & S_IXUSR)) {
+ printf("Application %s is not executable.\n", ap_name);
+ return -1;
+ }
+
return irm_bind(name, ap_name, flags, argc, argv);
}