diff options
| author | Brent Cook <busterb@gmail.com> | 2025-10-07 03:49:29 -0500 |
|---|---|---|
| committer | Brent Cook <busterb@gmail.com> | 2025-10-07 04:23:58 -0500 |
| commit | 659e87fe1cf3348a4e9f1bacfe205316fefd8a51 (patch) | |
| tree | 0bdf3c16aae53f30aceffc7848076f49ea84bdb4 /crypto | |
| parent | 2f78b04fd75ae457f8a1297909dd3b6f612bd21f (diff) | |
| download | portable-659e87fe1cf3348a4e9f1bacfe205316fefd8a51.tar.gz portable-659e87fe1cf3348a4e9f1bacfe205316fefd8a51.tar.bz2 portable-659e87fe1cf3348a4e9f1bacfe205316fefd8a51.zip | |
move ftruncate to common libcompat for tests
Diffstat (limited to 'crypto')
| -rw-r--r-- | crypto/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | crypto/Makefile.am | 4 | ||||
| -rw-r--r-- | crypto/compat/ftruncate.c | 17 |
3 files changed, 25 insertions, 0 deletions
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index aacd2a7..137cf70 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt | |||
| @@ -624,6 +624,10 @@ if(NOT HAVE_FREEZERO) | |||
| 624 | set(COMPAT_SRC ${COMPAT_SRC} compat/freezero.c) | 624 | set(COMPAT_SRC ${COMPAT_SRC} compat/freezero.c) |
| 625 | endif() | 625 | endif() |
| 626 | 626 | ||
| 627 | if(NOT HAVE_FTRUNCATE) | ||
| 628 | set(COMPAT_SRC ${COMPAT_SRC} compat/ftruncate.c) | ||
| 629 | endif() | ||
| 630 | |||
| 627 | if(NOT HAVE_GETDELIM) | 631 | if(NOT HAVE_GETDELIM) |
| 628 | set(COMPAT_SRC ${COMPAT_SRC} compat/getdelim.c) | 632 | set(COMPAT_SRC ${COMPAT_SRC} compat/getdelim.c) |
| 629 | endif() | 633 | endif() |
diff --git a/crypto/Makefile.am b/crypto/Makefile.am index a116996..7fea236 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am | |||
| @@ -148,6 +148,10 @@ if !HAVE_FREEZERO | |||
| 148 | libcompat_la_SOURCES += compat/freezero.c | 148 | libcompat_la_SOURCES += compat/freezero.c |
| 149 | endif | 149 | endif |
| 150 | 150 | ||
| 151 | if !HAVE_FTRUNCATE | ||
| 152 | libcompat_la_SOURCES += compat/ftruncate.c | ||
| 153 | endif | ||
| 154 | |||
| 151 | if !HAVE_GETDELIM | 155 | if !HAVE_GETDELIM |
| 152 | libcompat_la_SOURCES += compat/getdelim.c | 156 | libcompat_la_SOURCES += compat/getdelim.c |
| 153 | endif | 157 | endif |
diff --git a/crypto/compat/ftruncate.c b/crypto/compat/ftruncate.c new file mode 100644 index 0000000..e825e50 --- /dev/null +++ b/crypto/compat/ftruncate.c | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | /* | ||
| 2 | * Public domain | ||
| 3 | * | ||
| 4 | * Kinichiro Inoguchi <inoguchi@openbsd.org> | ||
| 5 | */ | ||
| 6 | |||
| 7 | #ifdef _WIN32 | ||
| 8 | |||
| 9 | #include <unistd.h> | ||
| 10 | |||
| 11 | int | ||
| 12 | ftruncate(int fd, off_t length) | ||
| 13 | { | ||
| 14 | return _chsize(fd, length); | ||
| 15 | } | ||
| 16 | |||
| 17 | #endif | ||
