mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
ae.c: set errno when error is not a failing syscall.
In this way the caller is able to perform better error checking or to use strerror() without the risk of meaningless error messages being displayed.
This commit is contained in:
parent
4dc1e0dd30
commit
e9261b1e2d
6
src/ae.c
6
src/ae.c
@ -38,6 +38,7 @@
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "ae.h"
|
#include "ae.h"
|
||||||
#include "zmalloc.h"
|
#include "zmalloc.h"
|
||||||
@ -104,7 +105,10 @@ void aeStop(aeEventLoop *eventLoop) {
|
|||||||
int aeCreateFileEvent(aeEventLoop *eventLoop, int fd, int mask,
|
int aeCreateFileEvent(aeEventLoop *eventLoop, int fd, int mask,
|
||||||
aeFileProc *proc, void *clientData)
|
aeFileProc *proc, void *clientData)
|
||||||
{
|
{
|
||||||
if (fd >= eventLoop->setsize) return AE_ERR;
|
if (fd >= eventLoop->setsize) {
|
||||||
|
errno = ERANGE;
|
||||||
|
return AE_ERR;
|
||||||
|
}
|
||||||
aeFileEvent *fe = &eventLoop->events[fd];
|
aeFileEvent *fe = &eventLoop->events[fd];
|
||||||
|
|
||||||
if (aeApiAddEvent(eventLoop, fd, mask) == -1)
|
if (aeApiAddEvent(eventLoop, fd, mask) == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user