summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Luebbe <jlu@pengutronix.de>2013-05-02 16:47:12 +0200
committerLucas De Marchi <lucas.de.marchi@gmail.com>2013-05-11 00:54:15 -0300
commit5eac795b8b067842caec32f96d55a7554c3c67f9 (patch)
tree46679ea83400120d8dae8390d5b245177b33ee75
parent03f7dfb868b33ee73f2b1e36ab4a1bfa440dcd2c (diff)
downloadkmod-5eac795b8b067842caec32f96d55a7554c3c67f9.tar.gz
libkmod: Avoid calling syscall() with -1
At least in qemu 1.4.1 for vexpress/arm-cortexa9, this resulted in an illegal instruction error. Solve that by returning an error when __NR_finit_module is -1.
-rw-r--r--libkmod/missing.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/libkmod/missing.h b/libkmod/missing.h
index edb88b9..b45bbe2 100644
--- a/libkmod/missing.h
+++ b/libkmod/missing.h
@@ -20,8 +20,15 @@
#endif
#ifndef HAVE_FINIT_MODULE
+#include <errno.h>
+
static inline int finit_module(int fd, const char *uargs, int flags)
{
+ if (__NR_finit_module == -1) {
+ errno = ENOSYS;
+ return -1;
+ }
+
return syscall(__NR_finit_module, fd, uargs, flags);
}
#endif