install: fix incorrect 'Access denied' message with a non-existent unit

With "systemctl is-enabled non-existent.service"
_UNIT_FILE_STATE_INVALID (-1) was wrongly interpreted as -errno.
Return -ENOENT in this case.

https://bugzilla.redhat.com/show_bug.cgi?id=766579
This commit is contained in:
Michal Schmidt 2012-02-09 10:36:56 +01:00
parent ab5919fa1a
commit 81006b8ad8

View file

@ -1571,10 +1571,10 @@ UnitFileState unit_file_get_state(
}
if (lstat(path, &st) < 0) {
r = -errno;
if (errno == ENOENT)
continue;
r = -errno;
goto finish;
}