Update logs.

This commit is contained in:
2020-12-17 19:42:14 +03:00
parent afb184fa3f
commit 4a6495d786
7 changed files with 109 additions and 105 deletions

View File

@@ -1,4 +1,6 @@
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -16,8 +18,9 @@ __attribute__((stdcall)) uint32_t pci_read(uint32_t bus, uint32_t dev,
uint32_t value = 0;
sprintf(path, "%s/%4.4x:%2.2x:%2.2x.%u/config", pci_path, 0, bus, dev, fun);
int fd = open(path, O_RDONLY);
if (!fd) {
// TODO: report an error
if (fd == -1) {
// fprintf(stderr, "[pci] error: failed to open config file '%s': %s\n",
// path, strerror(errno));
return UINT32_MAX;
}
lseek(fd, offset, SEEK_SET);