lib: Add SAFE_RMDIR()

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/safe_macros.c b/lib/safe_macros.c
index fbee716..48a837c 100644
--- a/lib/safe_macros.c
+++ b/lib/safe_macros.c
@@ -168,6 +168,21 @@
 	return (rval);
 }
 
+int safe_rmdir(const char *file, const int lineno, void (*cleanup_fn) (void),
+               const char *pathname)
+{
+	int rval;
+
+	rval = rmdir(pathname);
+	if (rval == -1) {
+		tst_brkm(TBROK | TERRNO, cleanup_fn,
+			 "%s:%d: rmdir(%s) failed",
+			 file, lineno, pathname);
+	}
+
+	return (rval);
+}
+
 void *safe_mmap(const char *file, const int lineno, void (*cleanup_fn) (void),
 		void *addr, size_t length, int prot, int flags, int fd,
 		off_t offset)