macOS follow-up

This commit is contained in:
nhmall
2026-04-25 16:41:16 -04:00
parent 98308a8a7d
commit 532152ffc0
4 changed files with 31 additions and 7 deletions
+13 -6
View File
@@ -840,28 +840,35 @@ sys_random_seed(void)
}
return seed;
}
#if defined(MACOS) && defined(NHUUID)
extern char *get_macos_uuid(char **); /* sys/unix/macuuid.m */
extern void free_macos_uuid(void); /* sys/unix/macuuid.m */
#endif
void
get_nhuuid(void)
{
#if !defined(MACOS)
char struuid[37] = { 0 };
#endif
char *struuidptr = NULL;
#if defined(LINUX) && defined(NHUUID)
uuid_t binuuid;
#elif defined(MACOS) && defined(NHUUID)
char *struuid = NULL;
extern char *get_mac_uuid(char **); /* sys/unix/macuuid.m */
extern void free_macos_uuid(void); /* sys/unix/macuuid.m */
#endif
if (svn.nhuuid[0])
return;
#if defined(MACOS) && defined(NHUUID)
get_mac_uuid(&struuid);
get_macos_uuid(&struuidptr);
#elif defined(LINUX) && defined(NHUUID)
uuid_generate_random(binuuid);
uuid_unparse(binuuid, struuid);
struuidptr = &struuid[0];
#endif /* MACOS || LINUX */
Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", struuid);
Snprintf(svn.nhuuid, sizeof svn.nhuuid, "%s", struuidptr);
#if defined(MACOS) && defined(NHUUID)
free_macos_uuid();