]> git.ipfire.org Git - thirdparty/systemd.git/commit
manager: simplify error handling in manager_deserialize() 10353/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Oct 2018 11:54:13 +0000 (13:54 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 11 Oct 2018 12:34:02 +0000 (14:34 +0200)
commit05067c3c1f6909e5fac81e758aaf9d1dfd0ae0c4
tree180d93d73ae84f005660ba19704cef12329df840
parent4df7d537c8203557d330b68ba7833515ddd4e985
manager: simplify error handling in manager_deserialize()

If a memory error occurred, we would still go through the path which sets the
error on ferror(). It is unlikely that ferror() returns true, but it's seems
cleaner to just propagate the error we already have.

The handling of fgets() returning NULL is also simplified: according to the man
page, it returns NULL only on EOF or error. So if feof() returns true, I don't
think we should call ferror() again.

While at it, let's set errno to 0 and check that it is set before returning it
as an error. The man pages for fgets() and feof() do not say anything about
setting errno.
src/core/manager.c