]> Chaos Git - corbenik/ctrulib.git/commitdiff
Fix poll() to only update revents.
authormtheall <pigman46@gmail.com>
Sat, 24 Jan 2015 17:48:50 +0000 (11:48 -0600)
committerDave Murphy <davem@devkitpro.org>
Wed, 11 Feb 2015 22:15:09 +0000 (22:15 +0000)
libctru/source/services/soc/soc_poll.c

index 4bdbb2f397bbd7bd913187bfb07004aa9fbb9b1c..80b6514e8d0f97eba8bb197e70e3a6e81bb2a21c 100644 (file)
@@ -1,6 +1,7 @@
 #include "soc_common.h"
 #include <poll.h>
 #include <stdlib.h>
+#include <stdio.h>
 
 int poll(struct pollfd *fds, nfds_t nfds, int timeout)
 {
@@ -47,7 +48,7 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
        saved_threadstorage[1] = cmdbuf[0x104>>2];
 
        cmdbuf[0x100>>2] = (size<<14) | 2;
-       cmdbuf[0x104>>2] = (u32)fds;
+       cmdbuf[0x104>>2] = (u32)tmp_fds;
 
        if((ret = svcSendSyncRequest(SOCU_handle)) != 0)
        {
@@ -55,6 +56,11 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout)
                return ret;
        }
 
+       for(i = 0; i < nfds; ++i)
+       {
+               fds[i].revents = tmp_fds[i].revents;
+       }
+
        free(tmp_fds);
 
        cmdbuf[0x100>>2] = saved_threadstorage[0];