diff --git a/test/file.cpp b/test/file.cpp
index 6262a6f..e328c01 100644
--- a/test/file.cpp
+++ b/test/file.cpp
@@ -27,13 +27,16 @@ protected:
 	{
 		fileName_ = "/tmp/libcamera.test.XXXXXX";
 		int fd = mkstemp(&fileName_.front());
+		ssize_t ret;
+
 		if (fd == -1)
 			return TestFail;
 
-		write(fd, "libcamera", 9);
+		ret = write(fd, "libcamera", 9);
+
 		close(fd);
 
-		return TestPass;
+		return ret == 9? TestPass : TestFail;
 	}
 
 	int run()
