portable: fix marker_matches_images() and propagate errors correctly
marker_matches_images() was declared to return bool, but several of its
paths return a negative errno (OOM, parse errors, etc.). A negative int
coerces to true, so every such failure was reported as a "match".
Return int with the tristate semantics the callers already expect.
When detaching by image name instead of the original path, path_pick() may
not resolve a concrete path (e.g. a runtime overlay). Keep comparing the
caller-provided image name, and use the picked path only as an additional
canonical match when it exists.
Follow-up for
907952bbc92dd6656807d9b2eb0d0c94a4c9e865