From d582f0db16611f4757b8d184b72428f9406ccae3 Mon Sep 17 00:00:00 2001
From: Timo Sirainen <timo.sirainen@dovecot.fi>
Date: Tue, 16 Aug 2016 14:29:53 +0300
Subject: [PATCH] Adjust to unlink_directory() API changes.

---
 src/testsuite/testsuite-binary.c    | 8 +++++---
 src/testsuite/testsuite-common.c    | 8 +++++---
 src/testsuite/testsuite-mailstore.c | 8 +++++---
 src/testsuite/testsuite-smtp.c      | 8 +++++---
 4 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/testsuite/testsuite-binary.c b/src/testsuite/testsuite-binary.c
index 484716070..450ff96f2 100644
--- a/src/testsuite/testsuite-binary.c
+++ b/src/testsuite/testsuite-binary.c
@@ -43,9 +43,11 @@ void testsuite_binary_init(void)
 
 void testsuite_binary_deinit(void)
 {
-	if ( unlink_directory(testsuite_binary_tmp, TRUE) < 0 ) {
-		i_warning("failed to remove temporary directory '%s': %m.",
-			testsuite_binary_tmp);
+	const char *error;
+
+	if ( unlink_directory(testsuite_binary_tmp, UNLINK_DIRECTORY_FLAG_RMDIR, &error) < 0 ) {
+		i_warning("failed to remove temporary directory '%s': %s.",
+			testsuite_binary_tmp, error);
 	}
 
 	i_free(testsuite_binary_tmp);
diff --git a/src/testsuite/testsuite-common.c b/src/testsuite/testsuite-common.c
index 54be303b1..486c17030 100644
--- a/src/testsuite/testsuite-common.c
+++ b/src/testsuite/testsuite-common.c
@@ -261,9 +261,11 @@ static void testsuite_tmp_dir_init(void)
 
 static void testsuite_tmp_dir_deinit(void)
 {
-	if ( unlink_directory(testsuite_tmp_dir, TRUE) < 0 )
-		i_warning("failed to remove temporary directory '%s': %m.",
-			testsuite_tmp_dir);
+	const char *error;
+
+	if ( unlink_directory(testsuite_tmp_dir, UNLINK_DIRECTORY_FLAG_RMDIR, &error) < 0 )
+		i_warning("failed to remove temporary directory '%s': %s.",
+			testsuite_tmp_dir, error);
 
 	i_free(testsuite_tmp_dir);
 }
diff --git a/src/testsuite/testsuite-mailstore.c b/src/testsuite/testsuite-mailstore.c
index 91c16f14b..11e56102b 100644
--- a/src/testsuite/testsuite-mailstore.c
+++ b/src/testsuite/testsuite-mailstore.c
@@ -105,11 +105,13 @@ void testsuite_mailstore_init(void)
 
 void testsuite_mailstore_deinit(void)
 {
+	const char *error;
+
 	testsuite_mailstore_close();
 
-	if ( unlink_directory(testsuite_mailstore_location, TRUE) < 0 ) {
-		i_warning("failed to remove temporary directory '%s': %m.",
-			testsuite_mailstore_location);
+	if ( unlink_directory(testsuite_mailstore_location, UNLINK_DIRECTORY_FLAG_RMDIR, &error) < 0 ) {
+		i_warning("failed to remove temporary directory '%s': %s.",
+			testsuite_mailstore_location, error);
 	}
 
 	i_free(testsuite_mailstore_location);
diff --git a/src/testsuite/testsuite-smtp.c b/src/testsuite/testsuite-smtp.c
index b273135c5..ec61dd91d 100644
--- a/src/testsuite/testsuite-smtp.c
+++ b/src/testsuite/testsuite-smtp.c
@@ -52,9 +52,11 @@ void testsuite_smtp_init(void)
 
 void testsuite_smtp_deinit(void)
 {
-	if ( unlink_directory(testsuite_smtp_tmp, TRUE) < 0 )
-		i_warning("failed to remove temporary directory '%s': %m.",
-			testsuite_smtp_tmp);
+	const char *error;
+
+	if ( unlink_directory(testsuite_smtp_tmp, UNLINK_DIRECTORY_FLAG_RMDIR, &error) < 0 )
+		i_warning("failed to remove temporary directory '%s': %s.",
+			testsuite_smtp_tmp, error);
 
 	pool_unref(&testsuite_smtp_pool);
 }
-- 
GitLab