mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* is errno supposed to be positive or negative?
@ 2012-06-27  9:35 Uwe Kleine-König
  2012-06-27  9:51 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2012-06-27  9:35 UTC (permalink / raw)
  To: barebox

Hello,

Well, ok, errno is supposed to be zero, but in the rare cases where it's
not, what is intended?

Assuming ESOMETHING is always positive, in userspace errno is
positive, e.g. you test for errno == EBADF.

In barebox however most assignments use

	errno = -ESOMETHING

but there are also some tests and assignments without minus. barebox'
perror expects a negative errno which is also different from POSIX'
perror. strerror uses positive semantics in both barebox and POSIX.

I'd vote to fix barebox to use the same semantic for errno (and perror)
as POSIX.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-27 13:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-27  9:35 is errno supposed to be positive or negative? Uwe Kleine-König
2012-06-27  9:51 ` Sascha Hauer
2012-06-27 10:59   ` Uwe Kleine-König
2012-06-27 13:53     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox