File positions are off_t nowdays, not long, so:
atoi -> strtoll fseek -> fseeko NOTE: that fseek not works for >long offsets per POSIX: [EOVERFLOW] For fseek( ), the resulting file offset would be a value which cannot be represented correctly in an object of type long. Fix minor cast too.
This commit is contained in:
parent
e41ea14875
commit
1012cb601c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82851
@ -161,8 +161,8 @@ onalrm(signo)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void)lseek(uf, (off_t)0, L_SET);
|
(void)lseek(uf, (off_t)0, SEEK_SET);
|
||||||
nutmp = read(uf, utmp, (int)statbf.st_size)/sizeof(struct utmp);
|
nutmp = read(uf, utmp, (size_t)statbf.st_size)/sizeof(struct utmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ mailfor(name)
|
|||||||
if (!(cp = strchr(name, '@')))
|
if (!(cp = strchr(name, '@')))
|
||||||
return;
|
return;
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
offset = atoi(cp + 1);
|
offset = strtoll(cp + 1, NULL, 10);
|
||||||
if (!(cp = strchr(cp + 1, ':')))
|
if (!(cp = strchr(cp + 1, ':')))
|
||||||
file = name;
|
file = name;
|
||||||
else
|
else
|
||||||
@ -266,7 +266,7 @@ jkfprintf(tp, user, file, offset)
|
|||||||
if ((fi = fopen(file, "r")) == NULL)
|
if ((fi = fopen(file, "r")) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(void)fseek(fi, offset, L_SET);
|
(void)fseeko(fi, offset, SEEK_CUR);
|
||||||
/*
|
/*
|
||||||
* Print the first 7 lines or 560 characters of the new mail
|
* Print the first 7 lines or 560 characters of the new mail
|
||||||
* (whichever comes first). Skip header crap other than
|
* (whichever comes first). Skip header crap other than
|
||||||
|
Loading…
Reference in New Issue
Block a user