04000
(with the leading zero) is an octal integer literal, and
2 (decimal) = 2 (octal) = O_RDWR
2050 (decimal) = 4002 (octal) = O_RDWR | O_NONBLOCK
which means that setting the O_NONBLOCK
flag just worked fine.
For easier comparison with the O_XXX
definitions you could print the flags as
an octal number:
printf("FD MODE 2 - %#o\n", fcntl(sfd,F_GETFL));
// Output: FD MODE 2 - 04002