Merge pull request #18 from ipearworks/fix

sharedmem: Fix incorrect usages of `strerror`
This commit is contained in:
Konrad Dybcio 2024-03-18 17:09:52 +01:00 committed by GitHub
commit 33e1e40615
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -418,7 +418,7 @@ static int rmtfs_mem_enumerate(struct rmtfs_mem *rmem)
if (!dir) { if (!dir) {
fprintf(stderr, fprintf(stderr,
"Unable to open reserved-memory device tree node: %s\n", "Unable to open reserved-memory device tree node: %s\n",
strerror(-errno)); strerror(errno));
close(basefd); close(basefd);
return -1; return -1;
} }
@ -430,7 +430,7 @@ static int rmtfs_mem_enumerate(struct rmtfs_mem *rmem)
dirfd = openat(basefd, de->d_name, O_DIRECTORY); dirfd = openat(basefd, de->d_name, O_DIRECTORY);
if (dirfd < 0) { if (dirfd < 0) {
fprintf(stderr, "failed to open %s: %s\n", fprintf(stderr, "failed to open %s: %s\n",
de->d_name, strerror(-errno)); de->d_name, strerror(errno));
ret = -1; ret = -1;
goto out; goto out;
} }
@ -438,7 +438,7 @@ static int rmtfs_mem_enumerate(struct rmtfs_mem *rmem)
regfd = openat(dirfd, "reg", O_RDONLY); regfd = openat(dirfd, "reg", O_RDONLY);
if (regfd < 0) { if (regfd < 0) {
fprintf(stderr, "failed to open reg of %s: %s\n", fprintf(stderr, "failed to open reg of %s: %s\n",
de->d_name, strerror(-errno)); de->d_name, strerror(errno));
ret = -1; ret = -1;
goto out; goto out;
} }
@ -452,7 +452,7 @@ static int rmtfs_mem_enumerate(struct rmtfs_mem *rmem)
rmem->size = be64toh(reg.qw[1]); rmem->size = be64toh(reg.qw[1]);
} else { } else {
fprintf(stderr, "failed to read reg of %s: %s\n", fprintf(stderr, "failed to read reg of %s: %s\n",
de->d_name, strerror(-errno)); de->d_name, strerror(errno));
ret = -1; ret = -1;
} }