Skip to contentSkip to conversation

xfs_fsr: fix test for short write

PATCH In review Eric Sandeen 2 participants 2 messages Sep 18, 2009 – Sep 22, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_fsr: fix test for short write

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.

---

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

fsr/xfs_fsr.c +0 -0
index 9f2bf24..253a55d 100644
@@ -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"),

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Eric Sandeen

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.

Looks good to me,

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs