| Line | Branch | Exec | Source | 
|---|---|---|---|
| 1 | #ifndef UTIL_XREADWRITE_H | ||
| 2 | #define UTIL_XREADWRITE_H | ||
| 3 | |||
| 4 | #include <errno.h> | ||
| 5 | #include <fcntl.h> | ||
| 6 | #include <sys/types.h> | ||
| 7 | #include "errorcode.h" | ||
| 8 | #include "macros.h" | ||
| 9 | |||
| 10 | NONNULL_ARGS WARN_UNUSED_RESULT | ||
| 11 | 283 | static inline int xopen(const char *path, int flags, mode_t mode) | |
| 12 | { | ||
| 13 | 283 | int fd; | |
| 14 | 283 | do { | |
| 15 | 283 | fd = open(path, flags | O_NOCTTY, mode); // NOLINT(*-unsafe-functions) | |
| 16 | 
        3/4✓ Branch 0 (4→5) taken 66 times. 
            ✓ Branch 1 (4→6) taken 217 times. 
            ✗ Branch 2 (5→3) not taken. 
            ✓ Branch 3 (5→6) taken 66 times. 
           | 
      283 | } while (fd < 0 && errno == EINTR); | 
| 17 | |||
| 18 | 283 | return fd; | |
| 19 | } | ||
| 20 | |||
| 21 | ssize_t xread(int fd, void *buf, size_t count) NONNULL_ARGS WARN_UNUSED_RESULT; | ||
| 22 | ssize_t xwrite(int fd, const void *buf, size_t count) NONNULL_ARGS WARN_UNUSED_RESULT; | ||
| 23 | ssize_t xread_all(int fd, void *buf, size_t count) NONNULL_ARGS WARN_UNUSED_RESULT; | ||
| 24 | ssize_t xwrite_all(int fd, const void *buf, size_t count) WARN_UNUSED_RESULT; | ||
| 25 | SystemErrno xclose(int fd); | ||
| 26 | |||
| 27 | #endif | ||
| 28 |