xfs
[Top] [All Lists]

[PATCH] xfs_fsr: fix test for short write

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfs_fsr: fix test for short write
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 17 Sep 2009 23:08:13 -0500
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)
Clang found this one too, as a dead nested assignment.

The point is to see if we write all the bytes; but the initial
assignment is backwards.  It's safe in the end, because if they
weren't already equal anyway, we'd have exited prior to this, but
it's worth fixing up for clarity.

Signed-of-by: Eric Sandeen <sandeen@xxxxxxxxxxx>
---

clang record:
http://sandeen.net/clang/xfsprogs/2009-09-09-1/report-xOZEHP.html#EndPath

diff --git a/fsr/xfs_fsr.c b/fsr/xfs_fsr.c
index 9f2bf24..253a55d 100644
--- a/fsr/xfs_fsr.c
+++ b/fsr/xfs_fsr.c
@@ -1190,7 +1190,7 @@ packfile(char *fname, char *tname, int fd,
                        }
                        if (nfrags) {
                                /* Do a matching write to the tmp file */
-                               wc = wc_b4;
+                               wc_b4 = wc;
                                if (((wc = write(ffd, fbuf, wc)) != wc_b4)) {
                                        fsrprintf(_("bad write of %d bytes "  
                                                "to %s: %s\n"),

<Prev in Thread] Current Thread [Next in Thread>