Index: /trunk/coverager.c
===================================================================
--- /trunk/coverager.c	(revision 766)
+++ /trunk/coverager.c	(revision 767)
@@ -172,7 +172,11 @@
 	p[1] = covlines;
 
-	ftruncate(fd, 0);
+	if (ftruncate(fd, 0) != 0) {
+		goto bailout;
+	}
 	lseek(fd, 0, SEEK_SET);
-	write(fd, (char *) buf, size);
+	if (write(fd, (char *) buf, size) != size) {
+		goto bailout;
+	}
 
 bailout:
Index: /trunk/mmap.c
===================================================================
--- /trunk/mmap.c	(revision 766)
+++ /trunk/mmap.c	(revision 767)
@@ -187,5 +187,10 @@
 		}
 	}
-	ftruncate(fd, size);
+
+	if (ftruncate(fd, size) != 0) {
+		perror(shm->name);
+		errstr = "Failed to ftruncate the file";
+		goto err;
+	}
 #endif
 
Index: /trunk/xcache.c
===================================================================
--- /trunk/xcache.c	(revision 766)
+++ /trunk/xcache.c	(revision 767)
@@ -3156,5 +3156,8 @@
 	xcache_restore_signal_handler();
 	if (xc_coredump_dir && xc_coredump_dir[0]) {
-		chdir(xc_coredump_dir);
+		if (chdir(xc_coredump_dir) != 0) {
+			/* error, but nothing can do about it
+			 * and should'nt print anything which might SEGV again */
+		}
 	}
 	raise(sig);
