diff options
author | Alistair Delva <adelva@google.com> | 2020-08-21 00:00:13 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-08-21 00:00:13 +0000 |
commit | ed358b3546c776c1c677fd88eb8f716cf6187510 (patch) | |
tree | 3c6134bcb2cda4b9dccc57b4a8b997a945aab62d /openbsd-compat/bsd-misc.h | |
parent | 22246b08952d746a7cc5a292570636cf4277598f (diff) | |
parent | 44a1065de8a58c51a021243a28bfa01e87822e4f (diff) |
Merge changes I934c73d4,I28cdc9a0,I9e734da9,I3c079d86
* changes:
UPSTREAM: depend
UPSTREAM: upstream: avoid possible NULL deref; from Pedro Martelletto
Revert "upstream: fix compilation with DEBUG_KEXDH; bz#3160 ok dtucker@"
Merge upstream-master into master
Diffstat (limited to 'openbsd-compat/bsd-misc.h')
-rw-r--r-- | openbsd-compat/bsd-misc.h | 92 |
1 files changed, 79 insertions, 13 deletions
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h index 65c18ec2..3a7dd6f4 100644 --- a/openbsd-compat/bsd-misc.h +++ b/openbsd-compat/bsd-misc.h @@ -1,5 +1,3 @@ -/* $Id: bsd-misc.h,v 1.25 2013/08/04 11:48:41 dtucker Exp $ */ - /* * Copyright (c) 1999-2004 Damien Miller <djm@mindrot.org> * @@ -49,7 +47,7 @@ int setegid(uid_t); #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR) const char *strerror(int); -#endif +#endif #if !defined(HAVE_SETLINEBUF) #define setlinebuf(a) (setvbuf((a), NULL, _IOLBF, 0)) @@ -66,20 +64,43 @@ struct timeval { int utimes(char *, struct timeval *); #endif /* HAVE_UTIMES */ +#ifndef AT_FDCWD +# define AT_FDCWD (-2) +#endif + +#ifndef HAVE_FCHMODAT +int fchmodat(int, const char *, mode_t, int); +#endif + +#ifndef HAVE_FCHOWNAT +int fchownat(int, const char *, uid_t, gid_t, int); +#endif + #ifndef HAVE_TRUNCATE int truncate (const char *, off_t); #endif /* HAVE_TRUNCATE */ -#if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP) #ifndef HAVE_STRUCT_TIMESPEC struct timespec { time_t tv_sec; long tv_nsec; }; -#endif +#endif /* !HAVE_STRUCT_TIMESPEC */ + +#if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP) +# include <time.h> int nanosleep(const struct timespec *, struct timespec *); #endif +#ifndef HAVE_UTIMENSAT +# include <time.h> +/* start with the high bits and work down to minimise risk of overlap */ +# ifndef AT_SYMLINK_NOFOLLOW +# define AT_SYMLINK_NOFOLLOW 0x80000000 +# endif +int utimensat(int, const char *, const struct timespec[2], int); +#endif /* !HAVE_UTIMENSAT */ + #ifndef HAVE_USLEEP int usleep(unsigned int useconds); #endif @@ -96,12 +117,6 @@ int tcsendbreak(int, int); int unsetenv(const char *); #endif -/* wrapper for signal interface */ -typedef void (*mysig_t)(int); -mysig_t mysignal(int sig, mysig_t act); - -#define signal(a,b) mysignal(a,b) - #ifndef HAVE_ISBLANK int isblank(int); #endif @@ -111,7 +126,7 @@ pid_t getpgid(pid_t); #endif #ifndef HAVE_ENDGRENT -# define endgrent() {} +# define endgrent() do { } while(0) #endif #ifndef HAVE_KRB5_GET_ERROR_MESSAGE @@ -119,7 +134,58 @@ pid_t getpgid(pid_t); #endif #ifndef HAVE_KRB5_FREE_ERROR_MESSAGE -# define krb5_free_error_message(a,b) while(0) +# define krb5_free_error_message(a,b) do { } while(0) +#endif + +#ifndef HAVE_PLEDGE +int pledge(const char *promises, const char *paths[]); +#endif + +/* bsd-err.h */ +#ifndef HAVE_ERR +void err(int, const char *, ...) __attribute__((format(printf, 2, 3))); +#endif +#ifndef HAVE_ERRX +void errx(int, const char *, ...) __attribute__((format(printf, 2, 3))); +#endif +#ifndef HAVE_WARN +void warn(const char *, ...) __attribute__((format(printf, 1, 2))); +#endif + +#ifndef HAVE_LLABS +long long llabs(long long); +#endif + +#if defined(HAVE_DECL_BZERO) && HAVE_DECL_BZERO == 0 +void bzero(void *, size_t); +#endif + +#ifndef HAVE_RAISE +int raise(int); +#endif + +#ifndef HAVE_GETSID +pid_t getsid(pid_t); +#endif + +#ifndef HAVE_FLOCK +# define LOCK_SH 0x01 +# define LOCK_EX 0x02 +# define LOCK_NB 0x04 +# define LOCK_UN 0x08 +int flock(int, int); +#endif + +#ifdef FFLUSH_NULL_BUG +# define fflush(x) (_ssh_compat_fflush(x)) +#endif + +#ifndef HAVE_LOCALTIME_R +struct tm *localtime_r(const time_t *, struct tm *); +#endif + +#ifndef HAVE_REALPATH +#define realpath(x, y) (sftp_realpath((x), (y))) #endif #endif /* _BSD_MISC_H */ |