aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-01-25 19:08:17 +0100
committerDmitry Vyukov <dvyukov@google.com>2016-01-26 16:48:37 +0100
commitefe43dc07148eb245f13e9cd30b42de21d514966 (patch)
tree2b638898be3fb6133122f8cce85b52106d99f1fb /executor/executor.cc
parent22fda1e655ea348edcbd2d748a1eb65d853b96ee (diff)
sys: open a bunch of new devices
Diffstat (limited to 'executor/executor.cc')
-rw-r--r--executor/executor.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/executor/executor.cc b/executor/executor.cc
index e48c26008..56115f909 100644
--- a/executor/executor.cc
+++ b/executor/executor.cc
@@ -586,15 +586,17 @@ void execute_call(thread_t* th)
debug("open(\"%s\", 0x%lx)\n", buf, flags);
th->res = open(buf, flags, 0);
} else {
+
// syz_open_dev(dev strconst, id intptr, flags flags[open_flags]) fd
uint64_t id = th->args[1];
uint64_t flags = th->args[2];
char buf[128];
strncpy(buf, dev, sizeof(buf));
buf[sizeof(buf) - 1] = 0;
- char* hash = strchr(buf, '#');
- if (hash != NULL)
+ while (char* hash = strchr(buf, '#')) {
*hash = '0' + (char)(id % 10); // 10 devices should be enough for everyone.
+ id /= 10;
+ }
debug("syz_open_dev(\"%s\", 0x%lx, 0)\n", buf, flags);
th->res = open(buf, flags, 0);
}