summaryrefslogtreecommitdiff
path: root/src/irmd
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-07-03 14:57:04 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-07-03 14:57:04 +0200
commit5a2123471a4b4a2bd8ee260879a207aebd5d1441 (patch)
treeddd0a2c6b620eeaedf85709f948f4b465b55299e /src/irmd
parentd2a7cb2d27dab595bd2948ad3724016ca948e61e (diff)
downloadouroboros-5a2123471a4b4a2bd8ee260879a207aebd5d1441.tar.gz
ouroboros-5a2123471a4b4a2bd8ee260879a207aebd5d1441.zip
irmd, tools: checks on binary
The bind tool and the auto_execute function will check if the binary exists and is executable. Return value of auto_execute corrected to pid_t
Diffstat (limited to 'src/irmd')
-rw-r--r--src/irmd/main.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index b4771b89..b14aa213 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1613,9 +1613,21 @@ static int flow_dealloc(int port_id)
return ret;
}
-static int auto_execute(char ** argv)
+static pid_t auto_execute(char ** argv)
{
pid_t api;
+ struct stat s;
+
+ if (stat(argv[0], &s) != 0) {
+ LOG_WARN("Application %s does not exist.", argv[0]);
+ return -1;
+ }
+
+ if (!(s.st_mode & S_IXUSR)) {
+ LOG_WARN("Application %s is not executable.", argv[0]);
+ return -1;
+ }
+
LOG_INFO("Executing %s.", argv[0]);
api = fork();
if (api == -1) {