From eb41dc747ec4b0b4c40d6482081a0c7782dca8d9 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Sun, 29 May 2016 23:56:29 +0200 Subject: Use off_t instead of long to make largefile support work MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already use the macro AC_SYS_LARGEFILE in configure.ac. This will only work properly if the correct types are used as well: replace long by off_t when calculating file offsets - which makes a difference on 32-bit systems. http://bugzilla.opensuse.org/show_bug.cgi?id=981522 Signed-off-by: Egbert Eich Found-by: Herbert Kütz Reviewed-by: Stefan Dirsch --- sessreg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sessreg.c b/sessreg.c index a86724b..0a8fdb2 100644 --- a/sessreg.c +++ b/sessreg.c @@ -366,7 +366,7 @@ main (int argc, char **argv) # else utmp = open (utmp_file, O_RDWR); if (utmp != -1) { - syserr ((int) lseek (utmp, (long) slot_number * sizeof (struct utmp), 0), "lseek"); + syserr ((int) lseek (utmp, (off_t) slot_number * sizeof (struct utmp), 0), "lseek"); sysnerr (write (utmp, (char *) &utmp_entry, sizeof (utmp_entry)) == sizeof (utmp_entry), "write utmp entry"); close (utmp); @@ -401,7 +401,7 @@ main (int argc, char **argv) if (llog != -1) { struct lastlog ll; - sysnerr (lseek(llog, (long) (pwd->pw_uid*sizeof(ll)), 0) + sysnerr (lseek(llog, (off_t) (pwd->pw_uid*sizeof(ll)), 0) != -1, "seeking lastlog entry"); memset(&ll, 0, sizeof(ll)); ll.ll_time = current_time; @@ -668,7 +668,7 @@ findslot (char *line_name, char *host_name, int addp, int slot) * first, try to locate a previous entry for this display * also record location of a free slots in case we need a new one */ - syserr ((int) lseek (utmp, (long) slot * sizeof (struct utmp), 0), "lseek"); + syserr ((int) lseek (utmp, (off_t) slot * sizeof (struct utmp), 0), "lseek"); if (!host_name) host_name = ""; -- cgit v1.2.3