r473 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Jul 14 14:12:46 CEST 2006


Author: phk
Date: 2006-07-14 14:12:46 +0200 (Fri, 14 Jul 2006)
New Revision: 473

Modified:
   trunk/varnish-cache/bin/varnishd/shmlog.c
Log:
Flexelint'ing, found a spurious ';'



Modified: trunk/varnish-cache/bin/varnishd/shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/shmlog.c	2006-07-14 12:05:28 UTC (rev 472)
+++ trunk/varnish-cache/bin/varnishd/shmlog.c	2006-07-14 12:12:46 UTC (rev 473)
@@ -105,8 +105,8 @@
 		if (n > 255)
 			n = 255; 	/* we truncate long fields */
 	}
-	p[1] = n;
-	p[2] = id >> 8;
+	p[1] = n & 0xff;
+	p[2] = (id >> 8) & 0xff;
 	p[3] = id & 0xff;
 	p[4 + n] = SLT_ENDMARKER;
 	p[0] = tag;
@@ -145,6 +145,7 @@
 	struct shmloghead slh;
 	int i = 0;
 
+	memset(&slh, 0, sizeof slh);	/* XXX: for flexelint */
 	heritage.vsl_fd = open(fn, O_RDWR, 0644);
 	if (heritage.vsl_fd >= 0)
 		i = read(heritage.vsl_fd, &slh, sizeof slh);
@@ -154,10 +155,9 @@
 		/* XXX more checks */
 
 		fprintf(stderr, "Creating new SHMFILE\n");
-		if (heritage.vsl_fd >= 0); {
+		if (heritage.vsl_fd >= 0)
 			close(heritage.vsl_fd);
-		}
-		unlink(fn);
+		(void)unlink(fn);
 		heritage.vsl_fd = open(fn, O_RDWR | O_CREAT, 0644);
 		if (heritage.vsl_fd < 0) {
 			fprintf(stderr, "Could not open %s: %s\n",
@@ -174,7 +174,7 @@
 		AZ(lseek(heritage.vsl_fd, 0, SEEK_SET));
 		i = write(heritage.vsl_fd, &slh, sizeof slh);
 		assert(i == sizeof slh);
-		AZ(ftruncate(heritage.vsl_fd, sizeof slh + size));
+		AZ(ftruncate(heritage.vsl_fd, (off_t)sizeof slh + (off_t)size));
 	}
 	heritage.vsl_size = slh.size + slh.start;
 




More information about the varnish-commit mailing list