diff options
author | Brent Cook <busterb@gmail.com> | 2019-01-31 09:45:56 -0600 |
---|---|---|
committer | Brent Cook <busterb@gmail.com> | 2019-01-31 13:56:56 -0600 |
commit | a6d7ea956290470254e817adb2f6a3fac9397a17 (patch) | |
tree | e9880ccf45612c854fd97287969b879c9a47e29d /crypto/compat | |
parent | 495a1b631687f6cc1a1e9fe217aa17184a1b4aff (diff) | |
download | portable-a6d7ea956290470254e817adb2f6a3fac9397a17.tar.gz portable-a6d7ea956290470254e817adb2f6a3fac9397a17.tar.bz2 portable-a6d7ea956290470254e817adb2f6a3fac9397a17.zip |
update autoconf for latest compat functions
Diffstat (limited to 'crypto/compat')
-rw-r--r-- | crypto/compat/getprogname_linux.c | 9 | ||||
-rw-r--r-- | crypto/compat/getprogname_windows.c | 13 | ||||
-rw-r--r-- | crypto/compat/posix_win.c | 7 | ||||
-rw-r--r-- | crypto/compat/syslog_r.c | 19 |
4 files changed, 48 insertions, 0 deletions
diff --git a/crypto/compat/getprogname_linux.c b/crypto/compat/getprogname_linux.c new file mode 100644 index 0000000..fefe5ea --- /dev/null +++ b/crypto/compat/getprogname_linux.c | |||
@@ -0,0 +1,9 @@ | |||
1 | #include <stdlib.h> | ||
2 | |||
3 | #include <errno.h> | ||
4 | |||
5 | const char * | ||
6 | getprogname(void) | ||
7 | { | ||
8 | return program_invocation_short_name; | ||
9 | } | ||
diff --git a/crypto/compat/getprogname_windows.c b/crypto/compat/getprogname_windows.c new file mode 100644 index 0000000..eb04ec0 --- /dev/null +++ b/crypto/compat/getprogname_windows.c | |||
@@ -0,0 +1,13 @@ | |||
1 | #include <stdlib.h> | ||
2 | |||
3 | #include <windows.h> | ||
4 | |||
5 | const char * | ||
6 | getprogname(void) | ||
7 | { | ||
8 | static char progname[MAX_PATH + 1]; | ||
9 | DWORD length = GetModuleFileName(NULL, progname, sizeof (progname) - 1); | ||
10 | if (length < 0) | ||
11 | return "?"; | ||
12 | return progname; | ||
13 | } | ||
diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c index d6e2dcb..b73f023 100644 --- a/crypto/compat/posix_win.c +++ b/crypto/compat/posix_win.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * BSD socket emulation code for Winsock2 | 4 | * BSD socket emulation code for Winsock2 |
5 | * File IO compatibility shims | 5 | * File IO compatibility shims |
6 | * Brent Cook <bcook@openbsd.org> | 6 | * Brent Cook <bcook@openbsd.org> |
7 | * Kinichiro Inoguchi <inoguchi@openbsd.org> | ||
7 | */ | 8 | */ |
8 | 9 | ||
9 | #define NO_REDEF_POSIX_FUNCTIONS | 10 | #define NO_REDEF_POSIX_FUNCTIONS |
@@ -208,6 +209,12 @@ posix_setsockopt(int sockfd, int level, int optname, | |||
208 | return rc == 0 ? 0 : wsa_errno(WSAGetLastError()); | 209 | return rc == 0 ? 0 : wsa_errno(WSAGetLastError()); |
209 | } | 210 | } |
210 | 211 | ||
212 | uid_t getuid(void) | ||
213 | { | ||
214 | /* Windows fstat sets 0 as st_uid */ | ||
215 | return 0; | ||
216 | } | ||
217 | |||
211 | #ifdef _MSC_VER | 218 | #ifdef _MSC_VER |
212 | struct timezone; | 219 | struct timezone; |
213 | int gettimeofday(struct timeval * tp, struct timezone * tzp) | 220 | int gettimeofday(struct timeval * tp, struct timezone * tzp) |
diff --git a/crypto/compat/syslog_r.c b/crypto/compat/syslog_r.c new file mode 100644 index 0000000..d68169d --- /dev/null +++ b/crypto/compat/syslog_r.c | |||
@@ -0,0 +1,19 @@ | |||
1 | #include <syslog.h> | ||
2 | |||
3 | void | ||
4 | syslog_r(int pri, struct syslog_data *data, const char *fmt, ...) | ||
5 | { | ||
6 | va_list ap; | ||
7 | |||
8 | va_start(ap, fmt); | ||
9 | vsyslog_r(pri, data, fmt, ap); | ||
10 | va_end(ap); | ||
11 | } | ||
12 | |||
13 | void | ||
14 | vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) | ||
15 | { | ||
16 | #ifdef HAVE_SYSLOG | ||
17 | vsyslog(pri, fmt, ap); | ||
18 | #endif | ||
19 | } | ||