Hi,

The manual of usleep(3) states that a usleep() greater than 1,000,000 
microseconds shall fail and return -1. However it does not.

[EINVAL]           /microseconds/ specified a value of 1,000,000 or more
                   microseconds.

$ echo 'int main() { return usleep(1000001); }' | gcc -xc - && ./a.out; echo $?
    0m1.03s real     0m0.00s user     0m0.02s system
0

        rqt.tv_sec = useconds / 1000000;
        rqt.tv_nsec = (useconds % 1000000) * 1000;
        return(nanosleep(&rqt, NULL));

I think it would make more sense to remove this statement rather than changing 
usleep.

Reply via email to