]> xenbits.xensource.com Git - people/liuw/rumprun.git/commitdiff
return correct value from -1/errno stub
authorAntti Kantee <pooka@iki.fi>
Thu, 16 Apr 2015 21:45:52 +0000 (21:45 +0000)
committerAntti Kantee <pooka@iki.fi>
Thu, 16 Apr 2015 21:45:52 +0000 (21:45 +0000)
IIRC, this makes some functions accidentally work "more incorrectly",
but at least it appears to make times() not hang.

lib/librumprun_base/libc_stubs.c

index 40bb69125150478ce079b28af72f9f009fa202e4..59a4cb7c31aeca895257b1c86fc9c40522de9a26 100644 (file)
 #include <errno.h>
 #include <stdio.h>
 
-/* XXX: incorrect return value, need to fix other things first */
 #define STUB_ERRNO(name)                               \
   int name(void); int name(void) {                     \
        static int done = 0;                            \
        errno = ENOTSUP;                                \
-       if (done) return ENOTSUP; done = 1;             \
+       if (done) return -1; done = 1;                  \
        fprintf(stderr, "STUB ``%s'' called\n", #name); \
-       return ENOTSUP;}
+       return -1;}
 
 #define STUB_RETURN(name)                              \
   int name(void); int name(void) {                     \