mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-21 19:26:22 +02:00
util/nvmutil: stricter errno on prw()
we want the first error to be the one shown, when returning negative Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -1384,7 +1384,6 @@ prw(int fd, void *mem, size_t count,
|
|||||||
{
|
{
|
||||||
off_t old;
|
off_t old;
|
||||||
ssize_t r;
|
ssize_t r;
|
||||||
int restore_errno;
|
|
||||||
int saved_errno = 0;
|
int saved_errno = 0;
|
||||||
|
|
||||||
if ((old = lseek_eintr(fd, (off_t)0, SEEK_CUR)) == (off_t)-1)
|
if ((old = lseek_eintr(fd, (off_t)0, SEEK_CUR)) == (off_t)-1)
|
||||||
@@ -1405,13 +1404,9 @@ prw(int fd, void *mem, size_t count,
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
|
|
||||||
restore_errno = errno;
|
|
||||||
|
|
||||||
if (lseek_eintr(fd, old, SEEK_SET) == (off_t)-1) {
|
if (lseek_eintr(fd, old, SEEK_SET) == (off_t)-1) {
|
||||||
if (saved_errno)
|
if (saved_errno)
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
else
|
|
||||||
errno = restore_errno;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user