|
@@ -497,7 +497,7 @@ int smartlist_split_string(smartlist_t *sl, const char *str, const char *sep,
|
|
cp = str;
|
|
cp = str;
|
|
while (1) {
|
|
while (1) {
|
|
if (skipSpace) {
|
|
if (skipSpace) {
|
|
- while (isspace(*cp)) ++cp;
|
|
|
|
|
|
+ while (isspace((int)*cp)) ++cp;
|
|
}
|
|
}
|
|
end = strstr(cp,sep);
|
|
end = strstr(cp,sep);
|
|
if (!end) {
|
|
if (!end) {
|
|
@@ -508,7 +508,7 @@ int smartlist_split_string(smartlist_t *sl, const char *str, const char *sep,
|
|
}
|
|
}
|
|
|
|
|
|
if (skipSpace) {
|
|
if (skipSpace) {
|
|
- while (end > cp && isspace(*(end-1)))
|
|
|
|
|
|
+ while (end > cp && isspace((int)*(end-1)))
|
|
--end;
|
|
--end;
|
|
}
|
|
}
|
|
smartlist_add(sl, tor_strndup(cp, end-cp));
|
|
smartlist_add(sl, tor_strndup(cp, end-cp));
|
|
@@ -874,6 +874,12 @@ tv_udiff(struct timeval *start, struct timeval *end)
|
|
long udiff;
|
|
long udiff;
|
|
long secdiff = end->tv_sec - start->tv_sec;
|
|
long secdiff = end->tv_sec - start->tv_sec;
|
|
|
|
|
|
|
|
+/* XXX some SunOS machines don't have LONG_MAX defined in the includes
|
|
|
|
+ * we use. Surely there is a better fix... */
|
|
|
|
+#ifndef LONG_MAX
|
|
|
|
+#define LONG_MAX 2147483647L
|
|
|
|
+#endif
|
|
|
|
+
|
|
if (secdiff+1 > LONG_MAX/1000000) {
|
|
if (secdiff+1 > LONG_MAX/1000000) {
|
|
log_fn(LOG_WARN, "comparing times too far apart.");
|
|
log_fn(LOG_WARN, "comparing times too far apart.");
|
|
return LONG_MAX;
|
|
return LONG_MAX;
|