On Dec 11, 2011, at 8:36 AM, abhinav narain wrote: > the return value of error is -1, > EINTR is 4.
For many UN*X APIs, "the return value" and "the error" are not the same; "the return value" on an error is -1, and "the error" is in the variable "errno". The select() man page on my system (not a Linux distribution, but that doesn't matter, UN*Xes are all the same here) says: RETURN VALUES Select() returns the number of ready descriptors that are contained in the descriptor sets, or -1 if an error occurred. If the time limit expires, select() returns 0. If select() returns with an error, includ- ing one due to an interrupted call, the descriptor sets will be unmodi- fied and the global variable errno will be set to indicate the error. so it's one of those APIs. What you should do is to, if select() returns -1 *and* errno is EINTR, just ignore the error and continue looping. > Also, it keeps printing ": Resource temporarily unavailable" > though I don't have any error statement to be printed. What is "it"? Your program? Or just *some* program? - This is the tcpdump-workers list. Visit https://cod.sandelman.ca/ to unsubscribe.