summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2010-08-23 22:56:08 +0100
committerColin Watson <cjwatson@debian.org>2010-08-23 22:56:08 +0100
commit31e30b835fd9695d3b6647cab4867001b092e28f (patch)
tree138e715c25661825457c7280cd66e3f4853d474c /misc.c
parent78eedc2c60ff4718200f9271d8ee4f437da3a0c5 (diff)
parent43094ebf14c9b16f1ea398bc5b65a7335e947288 (diff)
merge 5.6p1
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 e1f723123..a82e7936e 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.
@@ -178,6 +178,7 @@ strdelim(char **s)
178 return (NULL); /* no matching quote */ 178 return (NULL); /* no matching quote */
179 } else { 179 } else {
180 *s[0] = '\0'; 180 *s[0] = '\0';
181 *s += strspn(*s + 1, WHITESPACE) + 1;
181 return (old); 182 return (old);
182 } 183 }
183 } 184 }
@@ -425,7 +426,7 @@ colon(char *cp)
425 int flag = 0; 426 int flag = 0;
426 427
427 if (*cp == ':') /* Leading colon is part of file name. */ 428 if (*cp == ':') /* Leading colon is part of file name. */
428 return (0); 429 return NULL;
429 if (*cp == '[') 430 if (*cp == '[')
430 flag = 1; 431 flag = 1;
431 432
@@ -437,9 +438,9 @@ colon(char *cp)
437 if (*cp == ':' && !flag) 438 if (*cp == ':' && !flag)
438 return (cp); 439 return (cp);
439 if (*cp == '/') 440 if (*cp == '/')
440 return (0); 441 return NULL;
441 } 442 }
442 return (0); 443 return NULL;
443} 444}
444 445
445/* function to assist building execv() arguments */ 446/* function to assist building execv() arguments */
@@ -849,6 +850,16 @@ ms_to_timeval(struct timeval *tv, int ms)
849 tv->tv_usec = (ms % 1000) * 1000; 850 tv->tv_usec = (ms % 1000) * 1000;
850} 851}
851 852
853int
854timingsafe_bcmp(const void *b1, const void *b2, size_t n)
855{
856 const unsigned char *p1 = b1, *p2 = b2;
857 int ret = 0;
858
859 for (; n > 0; n--)
860 ret |= *p1++ ^ *p2++;
861 return (ret != 0);
862}
852void 863void
853sock_set_v6only(int s) 864sock_set_v6only(int s)
854{ 865{