Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 1 | From 6820c53c3952f78185beb59f767c372fc745dcf3 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 11 Dec 2022 21:42:59 -0800 |
| 4 | Subject: [PATCH] Use AC_SYS_LARGEFILE macro to control largefile support |
| 5 | |
| 6 | The autoconf macro AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS=64 |
| 7 | where necessary to ensure that off_t and all interfaces using off_t |
| 8 | are 64bit, even on 32bit systems. |
| 9 | |
| 10 | replace stat64 by equivalent stat struct/func |
| 11 | |
| 12 | Upstream-Status: Accepted [https://github.com/thkukuk/rpcsvc-proto/pull/15] |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | --- |
| 15 | configure.ac | 1 + |
| 16 | rpcgen/rpc_main.c | 16 +++++----------- |
| 17 | 2 files changed, 6 insertions(+), 11 deletions(-) |
| 18 | |
| 19 | diff --git a/configure.ac b/configure.ac |
| 20 | index bacc2fb..a9fc730 100644 |
| 21 | --- a/configure.ac |
| 22 | +++ b/configure.ac |
| 23 | @@ -8,6 +8,7 @@ AC_PREFIX_DEFAULT(/usr) |
| 24 | AC_SUBST(PACKAGE) |
| 25 | AC_SUBST(VERSION) |
| 26 | |
| 27 | +AC_SYS_LARGEFILE |
| 28 | AC_PROG_CC |
| 29 | AC_GNU_SOURCE |
| 30 | AM_PROG_CC_C_O |
| 31 | diff --git a/rpcgen/rpc_main.c b/rpcgen/rpc_main.c |
| 32 | index 277adc6..fd7dea9 100644 |
| 33 | --- a/rpcgen/rpc_main.c |
| 34 | +++ b/rpcgen/rpc_main.c |
| 35 | @@ -62,12 +62,6 @@ |
| 36 | #define EXTEND 1 /* alias for TRUE */ |
| 37 | #define DONT_EXTEND 0 /* alias for FALSE */ |
| 38 | |
| 39 | -#ifdef __APPLE__ |
| 40 | -# if __DARWIN_ONLY_64_BIT_INO_T |
| 41 | -# define stat64 stat |
| 42 | -# endif |
| 43 | -#endif |
| 44 | - |
| 45 | struct commandline |
| 46 | { |
| 47 | int cflag; /* xdr C routines */ |
| 48 | @@ -337,9 +331,9 @@ clear_args (void) |
| 49 | static void |
| 50 | find_cpp (void) |
| 51 | { |
| 52 | - struct stat64 buf; |
| 53 | + struct stat buf; |
| 54 | |
| 55 | - if (stat64 (CPP, &buf) == 0) |
| 56 | + if (stat (CPP, &buf) == 0) |
| 57 | return; |
| 58 | |
| 59 | if (cppDefined) /* user specified cpp but it does not exist */ |
| 60 | @@ -1125,17 +1119,17 @@ putarg (int whereto, const char *cp) |
| 61 | static void |
| 62 | checkfiles (const char *infile, const char *outfile) |
| 63 | { |
| 64 | - struct stat64 buf; |
| 65 | + struct stat buf; |
| 66 | |
| 67 | if (infile) /* infile ! = NULL */ |
| 68 | - if (stat64 (infile, &buf) < 0) |
| 69 | + if (stat (infile, &buf) < 0) |
| 70 | { |
| 71 | perror (infile); |
| 72 | crash (); |
| 73 | } |
| 74 | if (outfile) |
| 75 | { |
| 76 | - if (stat64 (outfile, &buf) < 0) |
| 77 | + if (stat (outfile, &buf) < 0) |
| 78 | return; /* file does not exist */ |
| 79 | else |
| 80 | { |