optind seems to need unistd.h, not only getopt.h
--- e2fsprogs-1.42.4.orig/misc/e2undo.c	2012-03-18 19:18:33.000000000 +0100
+++ e2fsprogs-1.42.4/misc/e2undo.c	2012-07-26 18:48:09.000000000 +0200
@@ -20,6 +20,7 @@
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
+#include <unistd.h>
 #include "ext2fs/tdb.h"
 #include "ext2fs/ext2fs.h"
 #include "nls-enable.h"