Use errno correctly.

Make sure to check errno prior to doing anything
else that can modify it.

Change-Id: Id81ecc2c3fa07c222ab1e2ef6441331a1eaad635
This commit is contained in:
tao.pei 2015-08-17 20:18:49 +08:00
parent 6d24e0866f
commit a1038a9566

View file

@ -103,10 +103,11 @@ int Loop::lookupActive(const char *id, char *buffer, size_t len) {
}
rc = ioctl(fd, LOOP_GET_STATUS64, &li);
close(fd);
if (rc < 0 && errno == ENXIO) {
close(fd);
continue;
}
close(fd);
if (rc < 0) {
SLOGE("Unable to get loop status for %s (%s)", filename,