Introduce new error code E_SELECT.
authorAndre Noll <maan@systemlinux.org>
Wed, 10 Oct 2007 17:33:26 +0000 (19:33 +0200)
committerAndre Noll <maan@systemlinux.org>
Wed, 10 Oct 2007 17:33:26 +0000 (19:33 +0200)
At least para_audioc uses the negative return value of para_select()
to print an error message.

error.h
fd.c

diff --git a/error.h b/error.h
index 5d61db212265fc48bff91e44c14f5d7e1f134f19..51ee2098210479ceea640a1e044d61d2bfc274a0 100644 (file)
--- a/error.h
+++ b/error.h
@@ -370,6 +370,7 @@ extern const char **para_errlist[];
        PARA_ERROR(F_GETFL, "failed to get fd flags"), \
        PARA_ERROR(F_SETFL, "failed to set fd flags"), \
        PARA_ERROR(FGETS, "fgets error"), \
+       PARA_ERROR(SELECT, "select error"), \
 
 
 #define WRITE_ERRORS \
diff --git a/fd.c b/fd.c
index 556f3e96c073b12de38496c595042616a96bafa0..f0e849d1a71509d7a22a994ea77292c929bfd44f 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -51,9 +51,11 @@ int para_select(int n, fd_set *readfds, fd_set *writefds,
                ret = select(n, readfds, writefds, NULL, timeout_tv);
                err = errno;
        } while (ret < 0 && err == EINTR);
-       if (ret < 0)
+       if (ret < 0) {
                PARA_CRIT_LOG("select error: %s, max_fileno: %d\n",
                        strerror(err), n);
+               ret = -E_SELECT;
+       }
        return ret;
 }