lib: handle read failure in sync case

This amends the previous commit with a more concise condition.