From 677025966be609524b6b10974d51eb9126b25295 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 15 Apr 2024 17:12:51 +0200 Subject: [PATCH] tests: Call open() with the right flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build failed on the latest glibc (I think?), which caused this weird error: /usr/include/bits/fcntl2.h:50:11: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments In these three calls, open() was being called with 'r' flag, whose hex value is 0x72, and happens to set the O_CREAT flag (0x40) which was causing this error. The correct flag to pass is O_RDONLY. This issue exists since the creation of that file, I’m surprised it was working previously. Signed-off-by: Emmanuel Gil Peyrot --- tests/color-management-test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/color-management-test.c b/tests/color-management-test.c index 630462e4..5db56153 100644 --- a/tests/color-management-test.c +++ b/tests/color-management-test.c @@ -595,7 +595,7 @@ create_icc_based_image_description(struct color_manager *cm, int32_t icc_fd; struct stat st; - icc_fd = open(icc_path, 'r'); + icc_fd = open(icc_path, O_RDONLY); assert(icc_fd >= 0); assert(fstat(icc_fd, &st) == 0); @@ -844,7 +844,7 @@ TEST(set_bad_icc_size_zero) image_descr_creator_icc = xx_color_manager_v2_new_icc_creator(cm.manager); - icc_fd = open(srgb_icc_profile_path, 'r'); + icc_fd = open(srgb_icc_profile_path, O_RDONLY); assert(icc_fd >= 0); /* Try setting ICC file with a bad size, it should fail. */ @@ -903,7 +903,7 @@ TEST(set_icc_twice) image_descr_creator_icc = xx_color_manager_v2_new_icc_creator(cm.manager); - icc_fd = open(srgb_icc_profile_path, 'r'); + icc_fd = open(srgb_icc_profile_path, O_RDONLY); assert(icc_fd >= 0); assert(fstat(icc_fd, &st) == 0);