summaryrefslogtreecommitdiff
path: root/sessreg.c
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2016-05-29 23:56:29 +0200
committerEgbert Eich <eich@freedesktop.org>2016-05-30 17:06:22 +0200
commiteb41dc747ec4b0b4c40d6482081a0c7782dca8d9 (patch)
tree64c93ee65a06b087846c6cbb745b6f780df00ba5 /sessreg.c
parent93f5d5abf6b214a4b36e00cd09174d24b2ed0a6d (diff)
Use off_t instead of long to make largefile support work
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 <eich@suse.de> Found-by: Herbert Kütz <herbert.kuetz@ofd-z.niedersachsen.de> Reviewed-by: Stefan Dirsch <sndirsch@suse.de>
Diffstat (limited to 'sessreg.c')
-rw-r--r--sessreg.c6
1 files 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 = "";