mirror of
https://review.coreboot.org/flashrom.git
synced 2025-08-17 04:14:42 +02:00
tests: Mock the mode_t variant of open
open has a second form with a mode_t argument. When mocking without this argument a caller trying to O_CREAT would have their mode_t argument discarded and a random stack variable would be used instead. BUG=b:187647884 BRANCH=None TEST=meson test Change-Id: I8c134e6d36a248d0f51985e389085a9e585fb83d Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69263 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
35243fdd7d
commit
67a393b88a
@@ -49,11 +49,6 @@ struct pci_dev {
|
||||
unsigned int device_id;
|
||||
};
|
||||
|
||||
/* POSIX open() flags, avoiding dependency on fcntl.h */
|
||||
#define O_RDONLY 0
|
||||
#define O_WRONLY 1
|
||||
#define O_RDWR 2
|
||||
|
||||
/* Linux I2C interface constants, avoiding linux/i2c-dev.h */
|
||||
#define I2C_SLAVE 0x0703
|
||||
|
||||
@@ -107,7 +102,7 @@ struct io_mock {
|
||||
int (*libusb_handle_events_timeout)(void *state, libusb_context *ctx, struct timeval *tv);
|
||||
|
||||
/* POSIX File I/O */
|
||||
int (*iom_open)(void *state, const char *pathname, int flags);
|
||||
int (*iom_open)(void *state, const char *pathname, int flags, mode_t mode);
|
||||
int (*iom_ioctl)(void *state, int fd, unsigned long request, va_list args);
|
||||
int (*iom_read)(void *state, int fd, void *buf, size_t sz);
|
||||
int (*iom_write)(void *state, int fd, const void *buf, size_t sz);
|
||||
|
Reference in New Issue
Block a user