summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-05 17:58:51 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-12-05 18:17:39 +0100
commit1525d7b86f317ebbf19ba69b597d6ff73c71fe5e (patch)
treeba003a0f5119bf4e52cef1402706540d1a302e61
parent0334843d9f0a73f613e1dd20e30e6f3333d12d62 (diff)
downloadouroboros-1525d7b86f317ebbf19ba69b597d6ff73c71fe5e.tar.gz
ouroboros-1525d7b86f317ebbf19ba69b597d6ff73c71fe5e.zip
tools: Allow binding AP specifying relative path
-rw-r--r--src/tools/irm/irm_bind_ap.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/tools/irm/irm_bind_ap.c b/src/tools/irm/irm_bind_ap.c
index b558f072..b83e30dd 100644
--- a/src/tools/irm/irm_bind_ap.c
+++ b/src/tools/irm/irm_bind_ap.c
@@ -21,8 +21,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#define _POSIX_C_SOURCE 200809L
+#define _XOPEN_SOURCE 500
+
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <ouroboros/irm.h>
#include <ouroboros/errno.h>
@@ -47,6 +51,7 @@ int do_bind_ap(int argc, char ** argv)
char * ap_name = NULL;
uint16_t flags = 0;
int ret = 0;
+ char * temp = NULL;
while (argc > 0) {
if (matches(*argv, "name") == 0) {
@@ -54,8 +59,11 @@ int do_bind_ap(int argc, char ** argv)
++argv;
--argc;
} else if (matches(*argv, "ap") == 0) {
- ap_name = *(argv + 1);
++argv;
+ temp = realpath(*argv, NULL);
+ if (temp != NULL)
+ *argv = temp;
+ ap_name = *argv;
--argc;
} else if (strcmp(*argv, "auto") == 0) {
flags |= BIND_AP_AUTO;
@@ -92,5 +100,8 @@ int do_bind_ap(int argc, char ** argv)
return -1;
}
+ if (temp != NULL)
+ free(temp);
+
return ret;
}