return 0;
}
+ ret = -errno;
_E("Failed to create %s, %m", path);
- return -errno;
+
+ return ret;
}
/* set a new file size */
ret = ftruncate(fd, sizeof(struct compatibility_info) * HAL_MODULE_END);
if (ret < 0) {
+ ret = -errno;
_E("Failed to ftruncate %s, %m", path);
close(fd);
- return -errno;
+ return ret;
}
/* system_fw:system_fw */
offset = sizeof(struct compatibility_info) * module;
n_write = pwrite(fd, info, sizeof(*info), offset);
if (n_write == -1) {
+ ret = -errno;
_E("Failed to write info, %m");
close(fd);
- return -errno;
+ return ret;
}
close(fd);
int fd = -1;
size_t n_read = -1;
off_t offset;
+ int ret;
if (module < HAL_MODULE_UNKNOWN || module >= HAL_MODULE_END)
return -EINVAL;
offset = sizeof(struct compatibility_info) * module;
n_read = pread(fd, info, sizeof(*info), offset);
if (n_read == -1) {
+ ret = -errno;
close(fd);
- return -errno;
+ return ret;
}
close(fd);