I have a small utility application that handles sockets, both TCP and UDP. Occasionally, I get the error "Operation not permitted" printed to stderr. My issues is, I handle the errors based on the return codes of the socket functions (and occasionally errno), and don't print anything. Thus, this message must be coming from one of the socket calls. I am not sure which one, as this message occurs so infrequently, it has been difficult to debug, but I think it is either coming f开发者_JAVA技巧rom socket
or sendto
.
Is there a way to suppress all messages from being printed? I can handle the errors myself, I do not need the system doing it uncontrolled on my behalf.
Note, this is a Linux only application.
Thanks for the help.
Are you using any library on top of sockets API? The functions used to work with sockets are not supposed to print anything to stderr. I'd suggest using strace
and/or ltrace
to check where this message originates from in first place.
精彩评论