diff --git a/formats/format_wav.c b/formats/format_wav.c
index 17a4af054b..956b13e307 100644
--- a/formats/format_wav.c
+++ b/formats/format_wav.c
@@ -340,7 +340,7 @@ static void wav_close(struct ast_filestream *s)
 	char zero = 0;
 	struct wav_desc *fs = (struct wav_desc *)s->_private;
 
-	if ((s->mode & O_RDONLY) == O_RDONLY) {
+	if (s->mode == O_RDONLY) {
 		return;
 	}