c - What is the purpose of calling fcntl() be called with the file descriptor as -1 and cmd as F_GETFL? -


i trying understand line of code means:

flags = fcntl(-1,f_getfl,0); 

assuming talking function described man 2 fcntl:

flags = fcntl(-1,f_getfl,0); 

tries perform action on invalid file descriptor (-1) , therefore never else returning -1 , set errno ebadf.

i'd can savely replace line by:

flags = -1; errno = ebadf; 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -