mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-04 22:55:09 +08:00
SDL_utils.c: restrict gethostname() usage to non-windows
Reference issue: https://github.com/libsdl-org/SDL/issues/11228.
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "SDL_internal.h"
|
#include "SDL_internal.h"
|
||||||
|
|
||||||
#ifdef HAVE_GETHOSTNAME
|
#if defined(HAVE_GETHOSTNAME) && !defined(SDL_PLATFORM_WINDOWS)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ int SDL_URIToLocal(const char *src, char *dst)
|
|||||||
const size_t src_len = hostname_end - (src + 1);
|
const size_t src_len = hostname_end - (src + 1);
|
||||||
size_t hostname_len;
|
size_t hostname_len;
|
||||||
|
|
||||||
#ifdef HAVE_GETHOSTNAME
|
#if defined(HAVE_GETHOSTNAME) && !defined(SDL_PLATFORM_WINDOWS)
|
||||||
char hostname[257];
|
char hostname[257];
|
||||||
if (gethostname(hostname, 255) == 0) {
|
if (gethostname(hostname, 255) == 0) {
|
||||||
hostname[256] = '\0';
|
hostname[256] = '\0';
|
||||||
|
|||||||
Reference in New Issue
Block a user