public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sepdebugcrcfix: Do not use LFS64 functions
@ 2023-07-11 19:52 vimproved
  2023-07-12 13:01 ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: vimproved @ 2023-07-11 19:52 UTC (permalink / raw)
  To: debugedit; +Cc: Violet Purcell

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.

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);
-- 
2.41.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sepdebugcrcfix: Do not use LFS64 functions
  2023-07-11 19:52 [PATCH] sepdebugcrcfix: Do not use LFS64 functions vimproved
@ 2023-07-12 13:01 ` Mark Wielaard
       [not found]   ` <03575ebe3b2a670fee921927c0419a42@inventati.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2023-07-12 13:01 UTC (permalink / raw)
  To: vimproved, debugedit

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);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sepdebugcrcfix: Do not use LFS64 functions
       [not found]   ` <03575ebe3b2a670fee921927c0419a42@inventati.org>
@ 2023-07-13 10:27     ` Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2023-07-13 10:27 UTC (permalink / raw)
  To: vimproved; +Cc: debugedit

Hi Violet,

On Wed, Jul 12, 2023 at 09:22:44PM +0000, vimproved@inventati.org wrote:
> On 2023-07-12 13:01, Mark Wielaard wrote:
> >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?
> 
> My bad -- that is indeed what I meant! Thanks for pointing that out.

Thanks. Pushed with that changed as:

commit e62786537e980f18559f926abc7d669530235a22
Author: Violet Purcell <vimproved@inventati.org>
Date:   Tue Jul 11 15:52:57 2023 -0400

    sepdebugcrcfix: Do not use LFS64 functions
    
    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 32-bit glibc systems will be 64-bit, just replace the
    interfaces with their normal variants.
    
    Signed-off-by: Violet Purcell <vimproved@inventati.org>

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-13 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-11 19:52 [PATCH] sepdebugcrcfix: Do not use LFS64 functions vimproved
2023-07-12 13:01 ` Mark Wielaard
     [not found]   ` <03575ebe3b2a670fee921927c0419a42@inventati.org>
2023-07-13 10:27     ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).