add Windows preprocessor definitions around posix and pkcs11 changes
This commit is contained in:
parent
a1999590a8
commit
f2cd96282f
19
misc.c
19
misc.c
|
@ -316,14 +316,25 @@ static int
|
|||
waitfd(int fd, int *timeoutp, short events, volatile sig_atomic_t *stop)
|
||||
{
|
||||
struct pollfd pfd;
|
||||
#ifdef WINDOWS
|
||||
struct timeval t_start;
|
||||
int oerrno, r, have_timeout = (*timeoutp >= 0);
|
||||
#else
|
||||
struct timespec timeout;
|
||||
int oerrno, r;
|
||||
sigset_t nsigset, osigset;
|
||||
|
||||
if (timeoutp && *timeoutp == -1)
|
||||
timeoutp = NULL;
|
||||
#endif /* WINDOWS */
|
||||
|
||||
pfd.fd = fd;
|
||||
pfd.events = events;
|
||||
#ifdef WINDOWS
|
||||
for (; !have_timeout || *timeoutp >= 0;) {
|
||||
monotime_tv(&t_start);
|
||||
r = poll(&pfd, 1, *timeoutp);
|
||||
#else
|
||||
ptimeout_init(&timeout);
|
||||
if (timeoutp != NULL)
|
||||
ptimeout_deadline_ms(&timeout, *timeoutp);
|
||||
|
@ -339,12 +350,18 @@ waitfd(int fd, int *timeoutp, short events, volatile sig_atomic_t *stop)
|
|||
}
|
||||
}
|
||||
r = ppoll(&pfd, 1, ptimeout_get_tsp(&timeout),
|
||||
stop != NULL ? &osigset : NULL);
|
||||
stop != NULL ? &osigset : NULL);
|
||||
#endif /* WINDOWS */
|
||||
oerrno = errno;
|
||||
#ifdef WINDOWS
|
||||
if (have_timeout)
|
||||
ms_subtract_diff(&t_start, timeoutp);
|
||||
#else
|
||||
if (stop != NULL)
|
||||
sigprocmask(SIG_SETMASK, &osigset, NULL);
|
||||
if (timeoutp)
|
||||
*timeoutp = ptimeout_get_ms(&timeout);
|
||||
#endif /* WINDOWS */
|
||||
errno = oerrno;
|
||||
if (r > 0)
|
||||
return 0;
|
||||
|
|
|
@ -856,7 +856,7 @@ pkcs11_add_provider(char *name, char *pin, struct sshkey ***keysp,
|
|||
return -1;
|
||||
#else
|
||||
struct pkcs11_provider *p;
|
||||
if (fd < 0 && pkcs11_start_helper(name) < 0)
|
||||
if (fd < 0 && pkcs11_start_helper() < 0)
|
||||
return (-1);
|
||||
#endif /* WINDOWS */
|
||||
|
||||
|
|
4
sshd.c
4
sshd.c
|
@ -2031,8 +2031,8 @@ main(int ac, char **av)
|
|||
|
||||
/* Parse command-line arguments. */
|
||||
#ifdef WINDOWS
|
||||
while ((opt = getopt(ac, av,
|
||||
"C:E:b:c:f:g:h:k:o:p:u:46DGQRTdeiqrtVyz")) != -1) {
|
||||
while ((opt = getopt(ac, av,
|
||||
"C:E:b:c:f:g:h:k:o:p:u:46DGQRTdeiqrtVyz")) != -1) {
|
||||
#else
|
||||
while ((opt = getopt(ac, av,
|
||||
"C:E:b:c:f:g:h:k:o:p:u:46DGQRTdeiqrtV")) != -1) {
|
||||
|
|
Loading…
Reference in New Issue