From 4a835375057bce31cfc1d0ff907c604000066cd5 Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Wed, 12 Sep 2012 15:36:44 +0000 Subject: [PATCH] Remove needless (int) casts of write(2)'s 3rd argument. Also change blwrite() 'size' parameter to a ssize_t to better match write(2). --- sbin/fsck_ffs/fsck.h | 2 +- sbin/fsck_ffs/fsutil.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h index 6ac004e4fb52..4717760acad9 100644 --- a/sbin/fsck_ffs/fsck.h +++ b/sbin/fsck_ffs/fsck.h @@ -337,7 +337,7 @@ void blkerror(ino_t ino, const char *type, ufs2_daddr_t blk); char *blockcheck(char *name); int blread(int fd, char *buf, ufs2_daddr_t blk, long size); void bufinit(void); -void blwrite(int fd, char *buf, ufs2_daddr_t blk, long size); +void blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size); void blerase(int fd, ufs2_daddr_t blk, long size); void cacheino(union dinode *dp, ino_t inumber); void catch(int); diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 59b73c81ad21..a09941b1daaa 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -245,7 +245,7 @@ flush(int fd, struct bufarea *bp) (bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ", (long long)bp->b_bno); bp->b_errs = 0; - blwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size); + blwrite(fd, bp->b_un.b_buf, bp->b_bno, bp->b_size); if (bp != &sblk) return; for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) { @@ -392,7 +392,7 @@ blread(int fd, char *buf, ufs2_daddr_t blk, long size) } void -blwrite(int fd, char *buf, ufs2_daddr_t blk, long size) +blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size) { int i; char *cp; @@ -404,7 +404,7 @@ blwrite(int fd, char *buf, ufs2_daddr_t blk, long size) offset *= dev_bsize; if (lseek(fd, offset, 0) < 0) rwerror("SEEK BLK", blk); - else if (write(fd, buf, (int)size) == size) { + else if (write(fd, buf, size) == size) { fsmodified = 1; return; } @@ -414,7 +414,7 @@ blwrite(int fd, char *buf, ufs2_daddr_t blk, long size) rwerror("SEEK BLK", blk); printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:"); for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize) - if (write(fd, cp, (int)dev_bsize) != dev_bsize) { + if (write(fd, cp, dev_bsize) != dev_bsize) { (void)lseek(fd, offset + i + dev_bsize, 0); printf(" %jd,", (intmax_t)blk + i / dev_bsize); }