Skip to content

Commit

Permalink
Use AC_SYS_LARGEFILE macro to control largefile support
Browse files Browse the repository at this point in the history
The autoconf macro AC_SYS_LARGEFILE defines _FILE_OFFSET_BITS=64
where necessary to ensure that off_t and all interfaces using off_t
are 64bit, even on 32bit systems.

replace stat64 by equivalent stat struct/func

Signed-off-by: Khem Raj <[email protected]>
  • Loading branch information
kraj authored and thkukuk committed Dec 12, 2022
1 parent 71e0a12 commit 28d1adf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ AC_PREFIX_DEFAULT(/usr)
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)

AC_SYS_LARGEFILE
AC_PROG_CC
AC_GNU_SOURCE
AM_PROG_CC_C_O
Expand Down
16 changes: 5 additions & 11 deletions rpcgen/rpc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,6 @@
#define EXTEND 1 /* alias for TRUE */
#define DONT_EXTEND 0 /* alias for FALSE */

#ifdef __APPLE__
# if __DARWIN_ONLY_64_BIT_INO_T
# define stat64 stat
# endif
#endif

struct commandline
{
int cflag; /* xdr C routines */
Expand Down Expand Up @@ -337,9 +331,9 @@ clear_args (void)
static void
find_cpp (void)
{
struct stat64 buf;
struct stat buf;

if (stat64 (CPP, &buf) == 0)
if (stat (CPP, &buf) == 0)
return;

if (cppDefined) /* user specified cpp but it does not exist */
Expand Down Expand Up @@ -1125,17 +1119,17 @@ putarg (int whereto, const char *cp)
static void
checkfiles (const char *infile, const char *outfile)
{
struct stat64 buf;
struct stat buf;

if (infile) /* infile ! = NULL */
if (stat64 (infile, &buf) < 0)
if (stat (infile, &buf) < 0)
{
perror (infile);
crash ();
}
if (outfile)
{
if (stat64 (outfile, &buf) < 0)
if (stat (outfile, &buf) < 0)
return; /* file does not exist */
else
{
Expand Down

0 comments on commit 28d1adf

Please sign in to comment.