psacct/psacct-6.5.1-LargeFile.patch

90 lines
3.1 KiB
Diff
Raw Normal View History

diff -up acct-6.5.1/configure.pom acct-6.5.1/configure
--- acct-6.5.1/configure.pom 2009-09-06 20:06:58.000000000 +0200
+++ acct-6.5.1/configure 2009-12-21 15:24:37.000000000 +0100
@@ -3684,12 +3684,12 @@ fi
{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
$as_echo "$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
+ CFLAGS="$ac_save_CFLAGS -D_FILE_OFFSET_BITS=64"
elif test $ac_cv_prog_cc_g = yes; then
if test "$GCC" = yes; then
- CFLAGS="-g -O2"
+ CFLAGS="-g -O2 -D_FILE_OFFSET_BITS=64"
else
- CFLAGS="-g"
+ CFLAGS="-g -D_FILE_OFFSET_BITS=64"
fi
else
if test "$GCC" = yes; then
diff -up acct-6.5.1/file_rd.c.pom acct-6.5.1/file_rd.c
--- acct-6.5.1/file_rd.c.pom 2009-09-06 01:39:50.000000000 +0200
+++ acct-6.5.1/file_rd.c 2009-12-21 15:26:30.000000000 +0100
@@ -7,6 +7,9 @@
#include "config.h"
+#define _LARGEFILE_SOURCE 1
+#define _FILE_OFFSET_BITS 64
+
#include <stdio.h>
#ifdef HAVE_STRING_H
@@ -103,9 +106,9 @@ char *file_reader_get_entry(struct file_
if (fri->backwards)
{
- long offset, max_recs, recs_to_read;
+ off_t offset, max_recs, recs_to_read;
- if ((offset = ftell (fri->fp)) <= 0)
+ if ((offset = ftello (fri->fp)) <= 0)
goto no_more_records;
/* Read as many records as possible, up to
@@ -124,8 +127,8 @@ char *file_reader_get_entry(struct file_
if (debugging_enabled)
{
- long new_offset = ftell (fri->fp);
- fprintf (stddebug, "Did seek in file %ld --> %ld\n",
+ off_t new_offset = ftello (fri->fp);
+ fprintf (stddebug, "Did seek in file %lld --> %lld\n",
offset, new_offset);
}
@@ -134,7 +137,7 @@ char *file_reader_get_entry(struct file_
fatal ("get_entry: couldn't read from file");
if (debugging_enabled)
- fprintf (stddebug, "Got %ld records from file\n",
+ fprintf (stddebug, "Got %lld records from file\n",
recs_to_read);
/* don't need to check this, because the above read was fine */
diff -up acct-6.5.1/file_rd.h.pom acct-6.5.1/file_rd.h
--- acct-6.5.1/file_rd.h.pom 2009-09-05 03:15:49.000000000 +0200
+++ acct-6.5.1/file_rd.h 2009-12-21 15:27:24.000000000 +0100
@@ -4,6 +4,8 @@
* record-oriented files.
*
*/
+#define __USE_XOPEN
+#include <unistd.h>
struct file_list
{
@@ -19,9 +21,9 @@ struct file_rd_info
because we close files as soon as
we find their ends and free their
entries from the linked list */
- int recs_read; /* how many records are in our buffer? */
- int recs_left; /* how many records are left in the
- buffer to be used? */
+ off_t recs_read; /* how many records are in our buffer? */
+ off_t recs_left; /* how many records are left in the
+ buffer to be used? */
void *buffer; /* the buffer for the data */
int buffered_records; /* how many records to buffer */
int record_size; /* how big is each record? */