]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
testsuite: Fix checking __sysno
authorLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 9 Apr 2013 14:54:05 +0000 (11:54 -0300)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 9 Apr 2013 14:54:05 +0000 (11:54 -0300)
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.

testsuite/init_module.c

index f1e7f82fb5a274762a1685084859690f7b68c4d1..dad66e5918e318f665c811b749f8a4db5584783a 100644 (file)
@@ -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