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
Post a Comment