mirror of
https://github.com/linux-msm/rmtfs.git
synced 2024-11-23 12:14:12 +08:00
sharedmem: Fix incorrect usages of strerror
`strerror` takes the `errno` directly as its argument, negating it will result in an "Unknown error". Signed-off-by: Tianyi Liu <i.pear@outlook.com>
This commit is contained in:
parent
7a5ae7e0a5
commit
75cb81d197
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user