diff --git a/src/lib-sieve-tool/mail-raw.c b/src/lib-sieve-tool/mail-raw.c
index 6f8101cf9c25cf98e94ad9d8afd92b45dc4613fd..18ab391f47f0913ff351ed62077fe4a4ea40a4e0 100644
--- a/src/lib-sieve-tool/mail-raw.c
+++ b/src/lib-sieve-tool/mail-raw.c
@@ -68,9 +68,8 @@ static int seekable_fd_callback
 	}
 
 	/* we just want the fd, unlink it */
-	if (unlink(str_c(path)) < 0) {
+	if (i_unlink(str_c(path)) < 0) {
 		/* shouldn't happen.. */
-		i_error("unlink(%s) failed: %m", str_c(path));
 		i_close_fd(&fd);
 		return -1;
 	}
diff --git a/src/lib-sieve/storage/file/sieve-file-storage-active.c b/src/lib-sieve/storage/file/sieve-file-storage-active.c
index f0917a51ea110691cf71edfaa335eccb013d9063..a68c5c23d726e382aa19bbb49914aec9df01058a 100644
--- a/src/lib-sieve/storage/file/sieve-file-storage-active.c
+++ b/src/lib-sieve/storage/file/sieve-file-storage-active.c
@@ -163,7 +163,7 @@ int sieve_file_storage_active_replace_link
 
 	if ( ret < 0 ) {
 		/* Failed; created symlink must be deleted */
-		(void)unlink(active_path_new);
+		i_unlink(active_path_new);
 		sieve_storage_set_critical(storage,
 			"Performing rename() %s to %s failed: %m",
 			active_path_new, fstorage->active_path);
diff --git a/src/lib-sieve/storage/file/sieve-file-storage-save.c b/src/lib-sieve/storage/file/sieve-file-storage-save.c
index 4353fbec7728e836b350d60449a7a65a420f7040..edb91c3efdc93795aa7d9211c053d1d8d0896579 100644
--- a/src/lib-sieve/storage/file/sieve-file-storage-save.c
+++ b/src/lib-sieve/storage/file/sieve-file-storage-save.c
@@ -443,14 +443,14 @@ sieve_file_storage_save_to(struct sieve_file_storage *fstorage,
 			"read(%s) failed: %s", i_stream_get_name(input),
 			i_stream_get_error(input));
 		o_stream_destroy(&output);
-		(void)unlink(str_c(temp_path));
+		i_unlink(str_c(temp_path));
 		return -1;
 	case OSTREAM_SEND_ISTREAM_RESULT_ERROR_OUTPUT:
 		sieve_storage_set_critical(storage,
 			"write(%s) failed: %s", str_c(temp_path),
 			o_stream_get_error(output));
 		o_stream_destroy(&output);
-		(void)unlink(str_c(temp_path));
+		i_unlink(str_c(temp_path));
 		return -1;
 	}
 	o_stream_destroy(&output);
@@ -468,9 +468,8 @@ sieve_file_storage_save_to(struct sieve_file_storage *fstorage,
 				"rename(%s, %s) failed: %m",
 				str_c(temp_path), target);
 		}
+		i_unlink(str_c(temp_path));
 	}
-
-	(void)unlink(str_c(temp_path));
 	return 0;
 }
 
diff --git a/src/lib-sieve/util/program-client.c b/src/lib-sieve/util/program-client.c
index e7ddd214d501ba7973d629f89112e542102baf95..e0f0f9c64e102583cb08176b25f1480b007537b6 100644
--- a/src/lib-sieve/util/program-client.c
+++ b/src/lib-sieve/util/program-client.c
@@ -429,9 +429,8 @@ static int program_client_seekable_fd_callback
 	}
 
 	/* we just want the fd, unlink it */
-	if (unlink(str_c(path)) < 0) {
+	if (i_unlink(str_c(path)) < 0) {
 		/* shouldn't happen.. */
-		i_error("unlink(%s) failed: %m", str_c(path));
 		i_close_fd(&fd);
 		return -1;
 	}
diff --git a/src/sieve-tools/sieve-test.c b/src/sieve-tools/sieve-test.c
index 1b331774aa218c59c3e225048ff7df89f4408506..698ff4d3db8252cc42cb6636de81c533ac62a81c 100644
--- a/src/sieve-tools/sieve-test.c
+++ b/src/sieve-tools/sieve-test.c
@@ -398,7 +398,7 @@ int main(int argc, char **argv)
 			break;
 		case SIEVE_EXEC_BIN_CORRUPT:
 			i_info("corrupt binary deleted.");
-			(void) unlink(sieve_binary_path(sbin));
+			i_unlink_if_exists(sieve_binary_path(sbin));
 			/* fall through */
 		case SIEVE_EXEC_FAILURE:
 			i_info("final result: failed; resolved with successful implicit keep");