bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

The patch of glibc which allows the user to override the pfinet server


From: zhengda
Subject: The patch of glibc which allows the user to override the pfinet server
Date: Tue, 24 Jun 2008 19:01:59 +0200
User-agent: Thunderbird 2.0.0.14 (X11/20080421)

Hi,

I modified the code of glibc, so the user can override the default pfinet server by using the environment variable.
Here is the patch:
--- glibc-2.7-old/hurd/hurdsock.c    2008-06-21 01:38:30.040000000 +0200
+++ glibc-2.7/hurd/hurdsock.c    2008-06-21 01:45:28.340000000 +0200
@@ -76,6 +76,30 @@

  if (domain > max_domain || servers[domain] == MACH_PORT_NULL)
    {
+      char *sock_serv_path=NULL;
+      int len;
+      char *name=NULL;
+      char *np=NULL;
+      sock_serv_path=getenv("SOCK_SERV_PATH");
+      if(sock_serv_path == NULL)
+        sock_serv_path=_SERVERS_SOCKET;
+      len=strlen(sock_serv_path);
+      name=(char *)malloc(len+100);
+      if(name == NULL)
+        __libc_fatal ("hurd: Can't allocate the socket server path\n");
+      np=&name[len+100];
+      *--np = '\0';
+      np = _itoa (domain, np, 10, 0);
+      *--np = '/';
+
+      np -= len;
+      memcpy (np, sock_serv_path , len);
+
+      server = __file_name_lookup (np, 0, 0);
+      if (domain <= max_domain)
+        servers[domain] = server;
+      free(name);
+#if 0
      char name[sizeof (_SERVERS_SOCKET) + 100];
      char *np = &name[sizeof (name)];
      *--np = '\0';
@@ -86,6 +110,7 @@
      server = __file_name_lookup (np, 0, 0);
      if (domain <= max_domain)
      servers[domain] = server;
+#endif
    }
  else
    server = servers[domain];

Any comments?

Best,
Zheng Da




reply via email to

[Prev in Thread] Current Thread [Next in Thread]