Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/makefs/msdos Make it compile on 32bit AND 64bit archs.



details:   https://anonhg.NetBSD.org/src/rev/bf211ce67bc4
branches:  trunk
changeset: 784380:bf211ce67bc4
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jan 27 12:25:13 2013 +0000

description:
Make it compile on 32bit AND 64bit archs.

diffstat:

 usr.sbin/makefs/msdos/msdosfs_vnops.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (46 lines):

diff -r 78f5116114c4 -r bf211ce67bc4 usr.sbin/makefs/msdos/msdosfs_vnops.c
--- a/usr.sbin/makefs/msdos/msdosfs_vnops.c     Sun Jan 27 10:07:23 2013 +0000
+++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c     Sun Jan 27 12:25:13 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msdosfs_vnops.c,v 1.5 2013/01/27 10:07:23 mbalmer Exp $        */
+/*     $NetBSD: msdosfs_vnops.c,v 1.6 2013/01/27 12:25:13 martin Exp $ */
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -51,7 +51,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.5 2013/01/27 10:07:23 mbalmer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.6 2013/01/27 12:25:13 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/mman.h>
@@ -177,7 +177,7 @@
        int error, fd;
        size_t osize = dep->de_FileSize;
        struct stat *st = &node->inode->st;
-       off_t nsize = st->st_size;
+       size_t nsize;
        size_t offs = 0;
        struct msdosfsmount *pmp = dep->de_pmp;
        struct buf *bp;
@@ -188,15 +188,16 @@
        printf("msdosfs_write(): diroff %lu, dirclust %lu, startcluster %lu\n",
            dep->de_diroffset, dep->de_dirclust, dep->de_StartCluster);
 #endif
-       if (nsize == 0)
+       if (st->st_size == 0)
                return 0;
 
        /* Don't bother to try to write files larger than the fs limit */
-       if (nsize > MSDOSFS_FILESIZE_MAX) {
+       if (st->st_size > (off_t)min(MSDOSFS_FILESIZE_MAX,__SIZE_MAX__)) {
                errno = EFBIG;
                return -1;
        }
 
+       nsize = st->st_size;
        if (nsize > osize) {
                if ((error = deextend(dep, nsize, NULL)) != 0) {
                        errno = error;



Home | Main Index | Thread Index | Old Index