summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/misc.c b/misc.c
index f9da621d6..20d4300d9 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.75 2010/01/09 23:04:13 dtucker Exp $ */ 1/* $OpenBSD: misc.c,v 1.80 2010/07/21 02:10:58 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved. 4 * Copyright (c) 2005,2006 Damien Miller. All rights reserved.
@@ -179,6 +179,7 @@ strdelim(char **s)
179 return (NULL); /* no matching quote */ 179 return (NULL); /* no matching quote */
180 } else { 180 } else {
181 *s[0] = '\0'; 181 *s[0] = '\0';
182 *s += strspn(*s + 1, WHITESPACE) + 1;
182 return (old); 183 return (old);
183 } 184 }
184 } 185 }
@@ -426,7 +427,7 @@ colon(char *cp)
426 int flag = 0; 427 int flag = 0;
427 428
428 if (*cp == ':') /* Leading colon is part of file name. */ 429 if (*cp == ':') /* Leading colon is part of file name. */
429 return (0); 430 return NULL;
430 if (*cp == '[') 431 if (*cp == '[')
431 flag = 1; 432 flag = 1;
432 433
@@ -438,9 +439,9 @@ colon(char *cp)
438 if (*cp == ':' && !flag) 439 if (*cp == ':' && !flag)
439 return (cp); 440 return (cp);
440 if (*cp == '/') 441 if (*cp == '/')
441 return (0); 442 return NULL;
442 } 443 }
443 return (0); 444 return NULL;
444} 445}
445 446
446/* function to assist building execv() arguments */ 447/* function to assist building execv() arguments */
@@ -899,6 +900,16 @@ ms_to_timeval(struct timeval *tv, int ms)
899 tv->tv_usec = (ms % 1000) * 1000; 900 tv->tv_usec = (ms % 1000) * 1000;
900} 901}
901 902
903int
904timingsafe_bcmp(const void *b1, const void *b2, size_t n)
905{
906 const unsigned char *p1 = b1, *p2 = b2;
907 int ret = 0;
908
909 for (; n > 0; n--)
910 ret |= *p1++ ^ *p2++;
911 return (ret != 0);
912}
902void 913void
903sock_set_v6only(int s) 914sock_set_v6only(int s)
904{ 915{