mboxd: Check that window size is indeed a power of 2

The window size can be specified on the command line however we restrict
this to being a power of 2 due to the internal working of the daemon.

Currently we specify that this is the case in the help message but don't
explicitly verify this when parsing the command line.

Check that if the window size parameter is provided that the value is
indeed a power of 2 and error out if this is not the case.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Change-Id: I0cb36222d53830996380702802373d862010f503
diff --git a/mboxd.c b/mboxd.c
index 0ebba56..1307fe6 100644
--- a/mboxd.c
+++ b/mboxd.c
@@ -241,6 +241,10 @@
 				fprintf(stderr, "Unparseable window size\n");
 				return false;
 			}
+			if (!is_power_of_2(context->windows.default_size)) {
+				fprintf(stderr, "Window size not power of 2\n");
+				return false;
+			}
 			break;
 		case 'v':
 			verbosity++;