[systemd-devel] Antw: [EXT] D-bus connection Unknown error

Carlo Wood carlo at alinoe.com
Wed Mar 3 16:19:58 UTC 2021


On Wed, 03 Mar 2021 07:59:03 +0100
"Ulrich Windl" <Ulrich.Windl at rz.uni-regensburg.de> wrote:
> > Failed to get D-bus connection: Unknown error -1  
> 
> I have no idea, but I think "unknown error" is bad programming style;
> it's like "something went wrong; go and figure...".

I can't agree more (I always go out of my way to have
excellent error reporting in my own code), but I think
that what is going on here is that -1 was interpreted
as an 'errno' - and strerror was used to print a human
readable description.

If you pass -1 to strerror it returns "Unknown error -1",
because -1 isn't a known errno. Ie if you pass 10000
to it, it will say "Unknown error 10000".

The real problem therefore seems a bug in the code where
the return value of a function that is either >= 0 on success
and -1 on error is interpreted as errno.


More information about the systemd-devel mailing list