mirror of
https://github.com/libretro/libretro-common.git
synced 2024-05-11 09:05:27 -04:00
Resync
This commit is contained in:
parent
127ad8868b
commit
0fb7c411a3
|
@ -728,10 +728,16 @@ bool socket_connect_with_timeout(int fd, void *data, int timeout)
|
|||
return false;
|
||||
}
|
||||
|
||||
/* Excluded platforms do not have getsockopt implemented [GEKKO],
|
||||
* or it's returned values are unreliable [3DS].
|
||||
*/
|
||||
#if !defined(GEKKO) && !defined(_3DS) && defined(SO_ERROR)
|
||||
#if defined(GEKKO)
|
||||
/* libogc does not have getsockopt implemented */
|
||||
res = connect(fd, addr->ai_addr, addr->ai_addrlen);
|
||||
if (res < 0 && -res != EISCONN)
|
||||
return false;
|
||||
#elif defined(_3DS)
|
||||
/* libctru getsockopt does not return expected value */
|
||||
if (connect(fd, addr->ai_addr, addr->ai_addrlen) < 0 && errno != EISCONN)
|
||||
return false;
|
||||
#else
|
||||
{
|
||||
int error = -1;
|
||||
socklen_t errsz = sizeof(error);
|
||||
|
|
|
@ -81,13 +81,23 @@ void label_sanitize(char *label, bool (*left)(char*), bool (*right)(char*))
|
|||
if ((*left)(&label[lindex]))
|
||||
copy = false;
|
||||
else
|
||||
new_label[rindex++] = label[lindex];
|
||||
{
|
||||
const bool whitespace = label[lindex] == ' ' && (rindex == 0 || new_label[rindex - 1] == ' ');
|
||||
|
||||
/* Simplify consecutive whitespaces */
|
||||
if (!whitespace)
|
||||
new_label[rindex++] = label[lindex];
|
||||
}
|
||||
}
|
||||
else if ((*right)(&label[lindex]))
|
||||
copy = true;
|
||||
}
|
||||
|
||||
new_label[rindex] = '\0';
|
||||
/* Trim trailing whitespace */
|
||||
if (rindex > 0 && new_label[rindex - 1] == ' ')
|
||||
new_label[rindex - 1] = '\0';
|
||||
else
|
||||
new_label[rindex] = '\0';
|
||||
|
||||
strlcpy(label, new_label, PATH_MAX_LENGTH);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue