Use sizeof in get_hostname (bug 14401)

This commit is contained in:
rim
2018-05-27 11:04:42 +02:00
committed by Landry Breuil
parent 3af7e3d491
commit a76b13057c

View File

@@ -633,7 +633,7 @@ get_hostname (void)
#define HOST_NAME_MAX 255 #define HOST_NAME_MAX 255
#endif #endif
char hostname[HOST_NAME_MAX]; char hostname[HOST_NAME_MAX];
if (gethostname (hostname, HOST_NAME_MAX)) if (gethostname (hostname, sizeof(hostname)))
return g_strdup ("(unknown)"); return g_strdup ("(unknown)");
return g_strdup_printf ("%s", hostname); return g_strdup_printf ("%s", hostname);
} }