diff --git a/src/lib/fs/freespace.c b/src/lib/fs/freespace.c
index 2dbba3c5f..a7cf1ba96 100644
--- a/src/lib/fs/freespace.c
+++ b/src/lib/fs/freespace.c
@@ -20,6 +20,7 @@
 #endif
 
 #include <string.h>
+#include <errno.h>
 
 /** Return the amount of free disk space we have permission to use, in
  * bytes. Return -1 if the amount of free space can't be determined. */

