diff options
| author | Theo Buehler <tb@openbsd.org> | 2026-08-13 07:04:20 +0200 |
|---|---|---|
| committer | Theo Buehler <tb@openbsd.org> | 2026-08-13 07:04:20 +0200 |
| commit | 19455c1957470c627bf25db7efeca8f80651fdf3 (patch) | |
| tree | 0ef32dc231b954aeb9ea744719caf2eb176e68b8 | |
| parent | 964d95250d4e98984fcdd3c49697de703afe32cd (diff) | |
| parent | 05b343edd8581d797522051f1e903063429d6601 (diff) | |
| download | portable-19455c1957470c627bf25db7efeca8f80651fdf3.tar.gz portable-19455c1957470c627bf25db7efeca8f80651fdf3.tar.bz2 portable-19455c1957470c627bf25db7efeca8f80651fdf3.zip | |
Land #1357 - merge ftruncate shim into posix_win.c and fix it
| -rw-r--r-- | crypto/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | crypto/Makefile.am | 4 | ||||
| -rw-r--r-- | crypto/compat/ftruncate.c | 17 | ||||
| -rw-r--r-- | crypto/compat/posix_win.c | 8 | ||||
| -rw-r--r-- | m4/check-libc.m4 | 1 |
5 files changed, 8 insertions, 26 deletions
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 491b9b4..0698ab4 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt | |||
| @@ -637,10 +637,6 @@ if(NOT HAVE_FREEZERO) | |||
| 637 | set(COMPAT_SRC ${COMPAT_SRC} compat/freezero.c) | 637 | set(COMPAT_SRC ${COMPAT_SRC} compat/freezero.c) |
| 638 | endif() | 638 | endif() |
| 639 | 639 | ||
| 640 | if(NOT HAVE_FTRUNCATE) | ||
| 641 | set(COMPAT_SRC ${COMPAT_SRC} compat/ftruncate.c) | ||
| 642 | endif() | ||
| 643 | |||
| 644 | if(NOT HAVE_GETDELIM) | 640 | if(NOT HAVE_GETDELIM) |
| 645 | set(COMPAT_SRC ${COMPAT_SRC} compat/getdelim.c) | 641 | set(COMPAT_SRC ${COMPAT_SRC} compat/getdelim.c) |
| 646 | endif() | 642 | endif() |
diff --git a/crypto/Makefile.am b/crypto/Makefile.am index f703e33..7969aee 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am | |||
| @@ -148,10 +148,6 @@ 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 | |||
| 155 | if !HAVE_GETDELIM | 151 | if !HAVE_GETDELIM |
| 156 | libcompat_la_SOURCES += compat/getdelim.c | 152 | libcompat_la_SOURCES += compat/getdelim.c |
| 157 | endif | 153 | endif |
diff --git a/crypto/compat/ftruncate.c b/crypto/compat/ftruncate.c deleted file mode 100644 index e825e50..0000000 --- a/crypto/compat/ftruncate.c +++ /dev/null | |||
| @@ -1,17 +0,0 @@ | |||
| 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 | ||
diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c index 4e98643..60b2896 100644 --- a/crypto/compat/posix_win.c +++ b/crypto/compat/posix_win.c | |||
| @@ -68,6 +68,14 @@ libressl_fstat(int fd, struct stat *statbuf) | |||
| 68 | return fstat(get_real_fd(fd), statbuf); | 68 | return fstat(get_real_fd(fd), statbuf); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | #ifndef HAVE_FTRUNCATE | ||
| 72 | int | ||
| 73 | ftruncate(int fd, off_t length) | ||
| 74 | { | ||
| 75 | return _chsize(get_real_fd(fd), length); | ||
| 76 | } | ||
| 77 | #endif | ||
| 78 | |||
| 71 | int | 79 | int |
| 72 | posix_open(const char *path, ...) | 80 | posix_open(const char *path, ...) |
| 73 | { | 81 | { |
diff --git a/m4/check-libc.m4 b/m4/check-libc.m4 index 42867cc..8ecc89a 100644 --- a/m4/check-libc.m4 +++ b/m4/check-libc.m4 | |||
| @@ -39,7 +39,6 @@ AC_CACHE_CHECK([for getpagesize], ac_cv_func_getpagesize, [ | |||
| 39 | ]) | 39 | ]) |
| 40 | AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes]) | 40 | AM_CONDITIONAL([HAVE_ASPRINTF], [test "x$ac_cv_func_asprintf" = xyes]) |
| 41 | AM_CONDITIONAL([HAVE_FREEZERO], [test "x$ac_cv_func_freezero" = xyes]) | 41 | AM_CONDITIONAL([HAVE_FREEZERO], [test "x$ac_cv_func_freezero" = xyes]) |
| 42 | AM_CONDITIONAL([HAVE_FTRUNCATE], [test "x$ac_cv_func_ftruncate" = xyes]) | ||
| 43 | AM_CONDITIONAL([HAVE_GETDELIM], [test "x$ac_cv_func_getdelim" = xyes]) | 42 | AM_CONDITIONAL([HAVE_GETDELIM], [test "x$ac_cv_func_getdelim" = xyes]) |
| 44 | AM_CONDITIONAL([HAVE_GETLINE], [test "x$ac_cv_func_getline" = xyes]) | 43 | AM_CONDITIONAL([HAVE_GETLINE], [test "x$ac_cv_func_getline" = xyes]) |
| 45 | AM_CONDITIONAL([HAVE_GETPAGESIZE], [test "x$ac_cv_func_getpagesize" = xyes]) | 44 | AM_CONDITIONAL([HAVE_GETPAGESIZE], [test "x$ac_cv_func_getpagesize" = xyes]) |
