diff options
author | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2013-04-09 11:54:05 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.de.marchi@gmail.com> | 2013-04-09 11:54:05 -0300 |
commit | 8e00db9537fee379d900b352b4f6750c52d17726 (patch) | |
tree | f07773fcc330e3ff3d0110788be01c62ad18a5c3 | |
parent | 0ae58609dc0b983aa17ea7aa38c071cf1830819a (diff) | |
download | kmod-8e00db9537fee379d900b352b4f6750c52d17726.tar.gz kmod-8e00db9537fee379d900b352b4f6750c52d17726.tar.bz2 kmod-8e00db9537fee379d900b352b4f6750c52d17726.zip |
testsuite: Fix checking __sysno
Use an if instead of a case statemente. If __NR_finit_module is not
defined in system headers we define it to -1, causing a "duplicate case
value" error. Yet, we don't want to actually call our finit_module()
function if -1 is passed.
This also fix errno being set with negative value.
-rw-r--r-- | testsuite/init_module.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/testsuite/init_module.c b/testsuite/init_module.c index f1e7f82..dad66e5 100644 --- a/testsuite/init_module.c +++ b/testsuite/init_module.c @@ -309,11 +309,12 @@ TS_EXPORT long int syscall(long int __sysno, ...) va_list ap; long ret; - switch (__sysno) { - case -1: - errno = -ENOSYS; + if (__sysno == -1) { + errno = ENOSYS; return -1; - case __NR_finit_module: { + } + + if (__sysno == __NR_finit_module) { const char *args; int flags; int fd; @@ -329,7 +330,6 @@ TS_EXPORT long int syscall(long int __sysno, ...) va_end(ap); return ret; } - } /* * FIXME: no way to call the libc function - let's hope there are no |