aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorTheo Buehler <tb@openbsd.org>2026-08-13 07:04:20 +0200
committerTheo Buehler <tb@openbsd.org>2026-08-13 07:04:20 +0200
commit19455c1957470c627bf25db7efeca8f80651fdf3 (patch)
tree0ef32dc231b954aeb9ea744719caf2eb176e68b8 /crypto
parent964d95250d4e98984fcdd3c49697de703afe32cd (diff)
parent05b343edd8581d797522051f1e903063429d6601 (diff)
downloadportable-19455c1957470c627bf25db7efeca8f80651fdf3.tar.gz
portable-19455c1957470c627bf25db7efeca8f80651fdf3.tar.bz2
portable-19455c1957470c627bf25db7efeca8f80651fdf3.zip
Land #1357 - merge ftruncate shim into posix_win.c and fix it
Diffstat (limited to 'crypto')
-rw-r--r--crypto/CMakeLists.txt4
-rw-r--r--crypto/Makefile.am4
-rw-r--r--crypto/compat/ftruncate.c17
-rw-r--r--crypto/compat/posix_win.c8
4 files changed, 8 insertions, 25 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)
638endif() 638endif()
639 639
640if(NOT HAVE_FTRUNCATE)
641 set(COMPAT_SRC ${COMPAT_SRC} compat/ftruncate.c)
642endif()
643
644if(NOT HAVE_GETDELIM) 640if(NOT HAVE_GETDELIM)
645 set(COMPAT_SRC ${COMPAT_SRC} compat/getdelim.c) 641 set(COMPAT_SRC ${COMPAT_SRC} compat/getdelim.c)
646endif() 642endif()
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
148libcompat_la_SOURCES += compat/freezero.c 148libcompat_la_SOURCES += compat/freezero.c
149endif 149endif
150 150
151if !HAVE_FTRUNCATE
152libcompat_la_SOURCES += compat/ftruncate.c
153endif
154
155if !HAVE_GETDELIM 151if !HAVE_GETDELIM
156libcompat_la_SOURCES += compat/getdelim.c 152libcompat_la_SOURCES += compat/getdelim.c
157endif 153endif
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
11int
12ftruncate(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
72int
73ftruncate(int fd, off_t length)
74{
75 return _chsize(get_real_fd(fd), length);
76}
77#endif
78
71int 79int
72posix_open(const char *path, ...) 80posix_open(const char *path, ...)
73{ 81{