[PATCH] sepdebugcrcfix: Do not use LFS64 functions

Mark Wielaard mark@klomp.org
Wed Jul 12 13:01:23 GMT 2023


Hi Violet,

On Tue, 2023-07-11 at 15:52 -0400, Violet Purcell via Debugedit wrote:
> From: Violet Purcell <vimproved@inventati.org>
> 
> The LFS64 function calls have been gated behind the _LARGEFILE64_SOURCE
> macro in musl 1.2.4, and will be removed altogether in musl 1.2.5. Since
> configure.ac has the AC_SYS_LARGEFILE macro, which ensures that all
> functions on 64-bit glibc systems will be 64-bit, just replace the
> interfaces with their normal variants.

This looks sane. But when you say "ensures that all functions on 64-bit
glibc systems will be 64-bit" you mean "on 32-bit ... will be 64-bit"
don't you?

> Signed-off-by: Violet Purcell <vimproved@inventati.org>
> ---
>  tools/sepdebugcrcfix.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c
> index da50e6c..7464f6a 100644
> --- a/tools/sepdebugcrcfix.c
> +++ b/tools/sepdebugcrcfix.c
> @@ -139,7 +139,7 @@ crc32 (const char *fname, const char *base_fname, uint32_t *crcp)
>        error (0, errno, _("cannot open \"%s\""), debugname);
>        return false;
>      }
> -  off64_t size = lseek64 (fd, 0, SEEK_END);
> +  off_t size = lseek (fd, 0, SEEK_END);
>    if (size == -1)
>      {
>        error (0, errno, _("cannot get size of \"%s\""), debugname);
> @@ -284,7 +284,7 @@ process (Elf *elf, int fd, const char *fname)
>  	  return true;
>  	}
>        updated_count++;
> -      off64_t seekto = (shdr->sh_offset + data->d_off
> +      off_t seekto = (shdr->sh_offset + data->d_off
>  			+ (crcp - (const uint8_t *) data->d_buf));
>        uint32_t crc_targetendian = (ehdr->e_ident[EI_DATA] == ELFDATA2LSB
>  				   ? htole32 (crc) : htobe32 (crc));
> @@ -356,7 +356,7 @@ main (int argc, char **argv)
>  	error (0, errno, _("cannot chmod \"%s\" to make sure we can read and write"), fname);
>  
>        bool failed = false;
> -      int fd = open64 (fname, O_RDWR);
> +      int fd = open (fname, O_RDWR);
>        if (fd == -1)
>  	{
>  	  error (0, errno, _("cannot open \"%s\""), fname);



More information about the Debugedit mailing list