]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: Avoid calling syscall() with -1
authorJan Luebbe <jlu@pengutronix.de>
Thu, 2 May 2013 14:47:12 +0000 (16:47 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Sat, 11 May 2013 03:54:15 +0000 (00:54 -0300)
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.

libkmod/missing.h

index edb88b9fb3b62ee8b393d4b6deded107dcc3fa14..b45bbe297a7e495d8b6ac0210bfd35a9d9db41a4 100644 (file)
 #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