[igt-dev] [PATCH i-g-t] lib/igt_audio: fix filemode not specified in open(O_CREAT)

Simon Ser simon.ser at intel.com
Fri Apr 26 13:55:40 UTC 2019


open(3) takes va_args after the flags and O_CREAT will read the first one. If
we don't provide one, this is undefined behaviour.

(Someone reported it broke the build for them)

Signed-off-by: Simon Ser <simon.ser at intel.com>
Fixes: 311baff151f90c1db6f57ee9515216b4f9da5db7
---
 lib/igt_audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_audio.c b/lib/igt_audio.c
index 5b0860e6..fd8cf07c 100644
--- a/lib/igt_audio.c
+++ b/lib/igt_audio.c
@@ -447,7 +447,7 @@ int audio_create_wav_file_s32_le(const char *qualifier, uint32_t sample_rate,
 		*path = strdup(_path);
 
 	igt_debug("Dumping %s audio to %s\n", qualifier, _path);
-	fd = open(_path, O_WRONLY | O_CREAT | O_TRUNC);
+	fd = open(_path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
 	if (fd < 0) {
 		igt_warn("open failed: %s\n", strerror(errno));
 		return -1;
-- 
2.21.0



More information about the igt-dev mailing list