[PATCH app/sessreg] Use off_t instead of long to make largefile support work
Egbert Eich
eich at freedesktop.org
Sun May 29 22:01:14 UTC 2016
From: Egbert Eich <eich at suse.de>
We already use the AC_SYS_LARGEFILE in configure.ac. This macro will only
work properly if the correct tyles are used: relace long by off_t when
calculating file offsets.
Signed-off-by: Egbert Eich <eich at suse.de>
Found-by: Herbert Kütz <herbert.kuetz_at_ofd-z.niedersachsen.de>
---
sessreg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sessreg.c b/sessreg.c
index bdfe8f0..3efd8d9 100644
--- a/sessreg.c
+++ b/sessreg.c
@@ -327,7 +327,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);
@@ -362,7 +362,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;
@@ -628,7 +628,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 = "";
--
2.7.0
More information about the xorg-devel
mailing list