OSSP CVS Repository

ossp - Difference in ossp-pkg/path/path_self.c versions 1.1 and 1.2
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/path/path_self.c 1.1 -> 1.2

--- path_self.c  2002/08/23 15:33:18     1.1
+++ path_self.c  2002/08/26 18:40:33     1.2
@@ -80,6 +80,18 @@
         return PATH_OK;
     }
 
+    /* else search for /proc entries (at least possible under Linux and FreeBSD) */
+    if ((l = readlink("/proc/self/exe", res_buf, res_size-1)) == -1)
+        l = readlink("/proc/curproc/file", res_buf, res_size-1);
+    if (l > 0) {
+        if (res_buf[l-1] == '\0')
+           l--;
+        res_buf[l] = '\0';
+        if (strcmp(res_buf, "unknown") != 0)
+            if (path_resolve(res_buf, res_size, res_buf) == NULL)
+                return PATH_ERR_SYS;
+    }
+
     /* else search argv[0] in $PATH */
     if ((path = getenv("PATH")) == NULL)
         path = PATH_DEFAULT;

CVSTrac 2.0.1