Make grub_util_fd_seek match behaviour of other grub_util_fd_* and

fseeko.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-10-14 12:47:09 +02:00
parent dac86b182c
commit b73249d260
9 changed files with 39 additions and 32 deletions

View file

@ -139,15 +139,14 @@ grub_util_get_fd_size_file (grub_util_fd_t fd,
return ro;
}
grub_err_t
grub_util_fd_seek (grub_util_fd_t fd, const char *name, grub_uint64_t off)
int
grub_util_fd_seek (grub_util_fd_t fd, grub_uint64_t off)
{
switch (fd->type)
{
case GRUB_UTIL_FD_FILE:
if (lseek (fd->fd, 0, SEEK_SET) == (off_t) -1)
return grub_error (GRUB_ERR_BAD_DEVICE, N_("cannot seek `%s': %s"),
name, strerror (errno));
return -1;
fd->off = off;
return 0;
case GRUB_UTIL_FD_DISK:
@ -155,7 +154,7 @@ grub_util_fd_seek (grub_util_fd_t fd, const char *name, grub_uint64_t off)
return 0;
}
return 0;
return -1;
}
grub_util_fd_t