1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

Fixed printf format errors which corrupted /var/db/mounttab on i386's with

64-bit longs (don't assume that time_t is long; assume that time_t's are
representable as longs).
This commit is contained in:
Bruce Evans 2000-10-08 09:24:45 +00:00
parent e6ebb8d8a8
commit 97f1ce758f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66814

View File

@ -60,7 +60,8 @@ add_mtab(char *hostp, char *dirp) {
if ((mtabfile = fopen(PATH_MOUNTTAB, "a")) == NULL)
return (0);
else {
fprintf(mtabfile, "%ld\t%s\t%s\n", time(now), hostp, dirp);
fprintf(mtabfile, "%ld\t%s\t%s\n",
(long)time(now), hostp, dirp);
fclose(mtabfile);
return (1);
}
@ -149,8 +150,9 @@ write_mtab() {
for (mtabp = mtabhead; mtabp != NULL; mtabp = mtabp->mtab_next) {
if (mtabp->mtab_host != NULL &&
strlen(mtabp->mtab_host) > 0) {
fprintf(mtabfile, "%ld\t%s\t%s\n", mtabp->mtab_time,
mtabp->mtab_host, mtabp->mtab_dirp);
fprintf(mtabfile, "%ld\t%s\t%s\n",
(long)mtabp->mtab_time, mtabp->mtab_host,
mtabp->mtab_dirp);
if (verbose) {
warnx("write entry " "%s:%s",
mtabp->mtab_host, mtabp->mtab_dirp);