Skip to contentSkip to conversation

errno man page query

DISCUSSION Jon Grant 2 participants 2 messages Apr 22, 2012 1 message not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

Jon Grant

author
#0 lore raw

Hello

Quoting from this page:

http://man7.org/linux/man-pages/man3/errno.3.html

"a function that succeeds is allowed to change errno."

^ This sounds clear, e.g. open() can change errno to 0, when it returns a valid fd handle.

"Valid error numbers are all nonzero; errno is never set to zero by any system
call or library function."

^ This seems to be counter what the earlier line said. Therefore, open() wouldn't be allowed to change errno to 0.

Have I missed something?

Best regards, Jon
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hi Jon,

Quoted 12 lines · Jon Grant

Hello

Quoting from this page:

http://man7.org/linux/man-pages/man3/errno.3.html

"a function that succeeds is allowed to change errno."

^ This sounds clear, e.g. open() can change errno to 0, when it returns a valid fd handle.

Quoted 8 lines

"Valid error numbers are all nonzero; errno is never set to zero by any system
      call or library function."

^ This seems to be counter what the earlier line said. Therefore, open() wouldn't be allowed to change errno to 0.

Have I missed something?

I don't really see the problem. The first part says functions may change errno. The second part adds a qualification; they'll never change it to zero.

Cheers,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html