Skip to content

Commit

Permalink
2006-02-06 Gonzalo Paniagua Javier <[email protected]>
Browse files Browse the repository at this point in the history
	* shared.c: use MONO_SHARED_HOSTNAME as a substitute for gethostname()
	when creating the shared files in the .wapi directory. Fixes bug mono/mono#77371.


svn path=/trunk/mono/; revision=56605


Commit migrated from mono/mono@44630da
  • Loading branch information
gonzalop committed Feb 7, 2006
1 parent 071b6aa commit 9eeab28
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/mono/mono/io-layer/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,26 @@ static guchar *_wapi_shm_file (_wapi_shm_t type)
static guchar file[_POSIX_PATH_MAX];
guchar *name = NULL, *filename, *dir, *wapi_dir;
gchar machine_name[256];
gchar *fake_name;
struct utsname ubuf;
int ret;
int len;

ret = uname (&ubuf);
if (ret == -1) {
ubuf.machine[0] = '\0';
ubuf.sysname[0] = '\0';
}

if (gethostname(machine_name, sizeof(machine_name)) != 0)
machine_name[0] = '\0';

fake_name = g_getenv ("MONO_SHARED_HOSTNAME");
if (fake_name == NULL) {
if (gethostname(machine_name, sizeof(machine_name)) != 0)
machine_name[0] = '\0';
} else {
len = MIN (strlen (fake_name), sizeof (machine_name) - 1);
strncpy (machine_name, fake_name, len);
machine_name [len] = '\0';
}

switch (type) {
case WAPI_SHM_DATA:
Expand Down

0 comments on commit 9eeab28

Please sign in to comment.