tests: Call open() with the right flag

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 <linkmauve@linkmauve.fr>
This commit is contained in:
Emmanuel Gil Peyrot 2024-04-15 17:12:51 +02:00 committed by Marius Vlad
parent 875d4b1626
commit 677025966b

View file

@ -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);