diff options
Diffstat (limited to 'include/unistd.h')
| -rw-r--r-- | include/unistd.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h index 3c5eec9..7a49da0 100644 --- a/include/unistd.h +++ b/include/unistd.h | |||
| @@ -96,6 +96,17 @@ __fortify_read(int fd, void *buf, size_t n) | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | static inline __attribute__ ((always_inline)) | 98 | static inline __attribute__ ((always_inline)) |
| 99 | int | ||
| 100 | __fortify_ttyname_r(int fd, char *name, size_t n) | ||
| 101 | { | ||
| 102 | size_t bos = __builtin_object_size(name, 0); | ||
| 103 | |||
| 104 | if (n > bos) | ||
| 105 | __builtin_trap(); | ||
| 106 | return ttyname_r(fd, name, n); | ||
| 107 | } | ||
| 108 | |||
| 109 | static inline __attribute__ ((always_inline)) | ||
| 99 | ssize_t | 110 | ssize_t |
| 100 | __fortify_write(int fd, const void *buf, size_t n) | 111 | __fortify_write(int fd, const void *buf, size_t n) |
| 101 | { | 112 | { |
| @@ -126,6 +137,8 @@ __fortify_write(int fd, const void *buf, size_t n) | |||
| 126 | #define pread(fd, buf, n, offset) __fortify_pread(fd, buf, n, offset) | 137 | #define pread(fd, buf, n, offset) __fortify_pread(fd, buf, n, offset) |
| 127 | #undef read | 138 | #undef read |
| 128 | #define read(fd, buf, n) __fortify_read(fd, buf, n) | 139 | #define read(fd, buf, n) __fortify_read(fd, buf, n) |
| 140 | #undef ttyname_r | ||
| 141 | #define ttyname_r(fd, name, n) __fortify_ttyname_r(fd, name, n) | ||
| 129 | #undef write | 142 | #undef write |
| 130 | #define write(fd, buf, n) __fortify_write(fd, buf, n) | 143 | #define write(fd, buf, n) __fortify_write(fd, buf, n) |
| 131 | 144 | ||
