Fix forgotten errno return in evdev C code
This commit is contained in:
		@@ -1,10 +1,11 @@
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include "evdev.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int block_until_keypress(const char* keyboardPath) {
 | 
			
		||||
    int keyboardFd = open(keyboardPath, O_RDONLY);
 | 
			
		||||
    if (keyboardFd < 0) {
 | 
			
		||||
        return keyboardFd;
 | 
			
		||||
        return errno;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    int eventSize = sizeof(struct input_event);
 | 
			
		||||
@@ -15,7 +16,7 @@ int block_until_keypress(const char* keyboardPath) {
 | 
			
		||||
    while(readEvents) {
 | 
			
		||||
        bytesRead = read(keyboardFd, events, eventSize * NUM_EVENTS);
 | 
			
		||||
        if (bytesRead < 0) {
 | 
			
		||||
            return bytesRead;
 | 
			
		||||
            return errno;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        for(int i = 0; i < (bytesRead / eventSize); ++i) {
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@ func (Evdev) BlockUntilKeypress(devicePath string) error {
 | 
			
		||||
	defer C.free(unsafe.Pointer(path))
 | 
			
		||||
 | 
			
		||||
	ret := C.block_until_keypress(path)
 | 
			
		||||
	if ret < 0 {
 | 
			
		||||
	if ret != 0 {
 | 
			
		||||
		return syscall.Errno(ret)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user