mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
nvmutil: rename x_i_close to close_on_eintr
that's what it does. waits for eintr to stop firing Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -423,7 +423,7 @@ const char *getnvmprogname(void);
|
|||||||
char *new_tmpfile(int *fd, int local, const char *path);
|
char *new_tmpfile(int *fd, int local, const char *path);
|
||||||
int x_i_mkstemp(char *template);
|
int x_i_mkstemp(char *template);
|
||||||
char *x_c_tmpdir(void);
|
char *x_c_tmpdir(void);
|
||||||
int x_i_close(int fd);
|
int close_on_eintr(int fd);
|
||||||
int fsync_on_eintr(int fd);
|
int fsync_on_eintr(int fd);
|
||||||
|
|
||||||
/* asserts */
|
/* asserts */
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ fsync_dir(const char *path)
|
|||||||
if (fsync_on_eintr(dirfd) == -1)
|
if (fsync_on_eintr(dirfd) == -1)
|
||||||
goto err_fsync_dir;
|
goto err_fsync_dir;
|
||||||
|
|
||||||
if (x_i_close(dirfd) == -1)
|
if (close_on_eintr(dirfd) == -1)
|
||||||
goto err_fsync_dir;
|
goto err_fsync_dir;
|
||||||
|
|
||||||
if (dirbuf != NULL)
|
if (dirbuf != NULL)
|
||||||
@@ -170,7 +170,7 @@ err_fsync_dir:
|
|||||||
free(dirbuf);
|
free(dirbuf);
|
||||||
|
|
||||||
if (dirfd > -1)
|
if (dirfd > -1)
|
||||||
x_i_close(dirfd);
|
close_on_eintr(dirfd);
|
||||||
|
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ err_new_tmpfile:
|
|||||||
free(dest);
|
free(dest);
|
||||||
|
|
||||||
if (fd_tmp > -1)
|
if (fd_tmp > -1)
|
||||||
x_i_close(fd_tmp);
|
close_on_eintr(fd_tmp);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -901,7 +901,7 @@ try_err(int loop_err, int errval)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
x_i_close(int fd)
|
close_on_eintr(int fd)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
|
|||||||
@@ -246,12 +246,12 @@ write_to_gbe_bin(void)
|
|||||||
|
|
||||||
saved_errno = errno;
|
saved_errno = errno;
|
||||||
|
|
||||||
if (x_i_close(f->tmp_fd) == -1) {
|
if (close_on_eintr(f->tmp_fd) == -1) {
|
||||||
fprintf(stderr, "FAIL: %s: close\n", f->tname);
|
fprintf(stderr, "FAIL: %s: close\n", f->tname);
|
||||||
f->io_err_gbe_bin = 1;
|
f->io_err_gbe_bin = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x_i_close(f->gbe_fd) == -1) {
|
if (close_on_eintr(f->gbe_fd) == -1) {
|
||||||
fprintf(stderr, "FAIL: %s: close\n", f->fname);
|
fprintf(stderr, "FAIL: %s: close\n", f->fname);
|
||||||
f->io_err_gbe_bin = 1;
|
f->io_err_gbe_bin = 1;
|
||||||
}
|
}
|
||||||
@@ -487,7 +487,7 @@ gbe_mv(void)
|
|||||||
if (fsync_on_eintr(dest_fd) == -1)
|
if (fsync_on_eintr(dest_fd) == -1)
|
||||||
goto ret_gbe_mv;
|
goto ret_gbe_mv;
|
||||||
|
|
||||||
if (x_i_close(dest_fd) == -1)
|
if (close_on_eintr(dest_fd) == -1)
|
||||||
goto ret_gbe_mv;
|
goto ret_gbe_mv;
|
||||||
|
|
||||||
if (rename(dest_tmp, f->fname) == -1)
|
if (rename(dest_tmp, f->fname) == -1)
|
||||||
@@ -504,7 +504,7 @@ gbe_mv(void)
|
|||||||
ret_gbe_mv:
|
ret_gbe_mv:
|
||||||
|
|
||||||
if (f->gbe_fd > -1) {
|
if (f->gbe_fd > -1) {
|
||||||
if (x_i_close(f->gbe_fd) < 0)
|
if (close_on_eintr(f->gbe_fd) < 0)
|
||||||
rval = -1;
|
rval = -1;
|
||||||
if (fsync_dir(f->fname) < 0) {
|
if (fsync_dir(f->fname) < 0) {
|
||||||
f->io_err_gbe_bin = 1;
|
f->io_err_gbe_bin = 1;
|
||||||
@@ -514,7 +514,7 @@ ret_gbe_mv:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (f->tmp_fd > -1) {
|
if (f->tmp_fd > -1) {
|
||||||
if (x_i_close(f->tmp_fd) < 0)
|
if (close_on_eintr(f->tmp_fd) < 0)
|
||||||
rval = -1;
|
rval = -1;
|
||||||
|
|
||||||
f->tmp_fd = -1;
|
f->tmp_fd = -1;
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ rlong(void)
|
|||||||
sizeof(unsigned long), 0, IO_READ, LOOP_EAGAIN,
|
sizeof(unsigned long), 0, IO_READ, LOOP_EAGAIN,
|
||||||
LOOP_EINTR, MAX_ZERO_RW_RETRY, OFF_ERR);
|
LOOP_EINTR, MAX_ZERO_RW_RETRY, OFF_ERR);
|
||||||
|
|
||||||
if (x_i_close(fd) < 0)
|
if (close_on_eintr(fd) < 0)
|
||||||
err(errno, "Can't close randomness fd");
|
err(errno, "Can't close randomness fd");
|
||||||
|
|
||||||
if (nr != sizeof(unsigned long))
|
if (nr != sizeof(unsigned long))
|
||||||
|
|||||||
@@ -260,13 +260,13 @@ exit_cleanup(void)
|
|||||||
f = &x->f;
|
f = &x->f;
|
||||||
|
|
||||||
if (f->gbe_fd > -1) {
|
if (f->gbe_fd > -1) {
|
||||||
if (x_i_close(f->gbe_fd) == -1)
|
if (close_on_eintr(f->gbe_fd) == -1)
|
||||||
close_err = 1;
|
close_err = 1;
|
||||||
f->gbe_fd = -1;
|
f->gbe_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f->tmp_fd > -1) {
|
if (f->tmp_fd > -1) {
|
||||||
if (x_i_close(f->tmp_fd) == -1)
|
if (close_on_eintr(f->tmp_fd) == -1)
|
||||||
close_err = 1;
|
close_err = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user