[prev in list] [next in list] [prev in thread] [next in thread] 

List:       klik-devel
Subject:    [klik-devel] [klikclient commit] r1628 -
From:       codesite-noreply () google ! com
Date:       2008-07-31 17:31:55
Message-ID: 0015175cdba0db08110453553f01 () google ! com
[Download RAW message or body]

Author: lionel.tricon
Date: Fri Jul 25 09:29:22 2008
New Revision: 1628

Modified:
   trunk/client/trunk/kfakechroot/src/libfakechroot.c

Log:
Two improvements :
o avoid fakechroot_init to be launched twice
o remove useless code from readlink


Modified: trunk/client/trunk/kfakechroot/src/libfakechroot.c
==============================================================================
--- trunk/client/trunk/kfakechroot/src/libfakechroot.c	(original)
+++ trunk/client/trunk/kfakechroot/src/libfakechroot.c	Fri Jul 25 
09:29:22 2008
@@ -490,46 +490,6 @@
 void fakechroot_init (void) __attribute((constructor));
 void fakechroot_init (void)
 {
-    struct passwd* passwd = NULL;
-
-    if (!first) {
-        first = 1;
-
-        /* We get a list of directories or files */
-        if (getenv("FAKECHROOT_EXCLUDE_PATH")) {
-            char *v_ptr, *v_buf;
-            char *v_buffer = strdup(getenv("FAKECHROOT_EXCLUDE_PATH"));
-
-            v_ptr = strtok_r(v_buffer, ":", &v_buf);
-            for (;list_max<32;) {
-                if (v_ptr == NULL) break;
-                exclude_length[list_max] = strlen(v_ptr);
-                exclude_list[list_max] = malloc(exclude_length[list_max]+1);
-                strcpy(exclude_list[list_max], v_ptr);
-                list_max++;
-                v_ptr = strtok_r(NULL, ":", &v_buf);
-            }
-
-            free(v_buffer);
-        }
-
-        /* We don't want to loop into ourself */
-        fakechroot_base_root = getenv("FAKECHROOT_BASE_ROOT");
-        if (fakechroot_base_root == NULL) {
-            fakechroot_base_root = (char*)malloc(10);
-            strcpy(fakechroot_base_root, "/tmp/klik");
-        }
-        fakechroot_base_root_length = strlen(fakechroot_base_root);
-
-        /* We get the home of the user */
-        passwd = getpwuid(getuid());
-        if (passwd && passwd->pw_dir) {
-            home_path = malloc(strlen(passwd->pw_dir)+2);
-            strcpy(home_path, passwd->pw_dir);
-            strcat(home_path, "/");
-        }
-    }
-
 #ifdef HAVE___LXSTAT
     nextsym(__lxstat, "__lxstat");
 #endif
@@ -714,6 +674,46 @@
     nextsym(getgid, "getgid");
     nextsym(geteuid, "geteuid");
     nextsym(getegid, "getegid");
+
+    if (!first) {
+        struct passwd* passwd = NULL;
+        first = 1;
+
+        /* We get a list of directories or files */
+        if (getenv("FAKECHROOT_EXCLUDE_PATH")) {
+            char *v_ptr, *v_buf;
+            char *v_buffer = strdup(getenv("FAKECHROOT_EXCLUDE_PATH"));
+
+            v_ptr = strtok_r(v_buffer, ":", &v_buf);
+            for (;list_max<32;) {
+                if (v_ptr == NULL) break;
+                exclude_length[list_max] = strlen(v_ptr);
+                exclude_list[list_max] = malloc(exclude_length[list_max]+1);
+                strcpy(exclude_list[list_max], v_ptr);
+                list_max++;
+                v_ptr = strtok_r(NULL, ":", &v_buf);
+            }
+
+            free(v_buffer);
+        }
+
+        /* We don't want to loop into ourself */
+        fakechroot_base_root = getenv("FAKECHROOT_BASE_ROOT");
+        if (fakechroot_base_root == NULL) {
+            fakechroot_base_root = (char*)malloc(10);
+            strcpy(fakechroot_base_root, "/tmp/klik");
+        }
+        fakechroot_base_root_length = strlen(fakechroot_base_root);
+
+        /* We get the home of the user */
+        passwd = getpwuid(next_getuid());
+        if (passwd && passwd->pw_dir) {
+            home_path = malloc(strlen(passwd->pw_dir)+2);
+            strcpy(home_path, passwd->pw_dir);
+            strcat(home_path, "/");
+        }
+    }
+
 }

 /* Expand a path to be absolute */
@@ -2261,12 +2261,7 @@
         closedir(v_dir);
     }

-    if (next_readlink == NULL) fakechroot_init();
-    if ((v_status = next_readlink(path, tmp, bufsiz)) == -1) return v_status;
-    tmp[v_status] = '\0';
-
-    strcpy(buf, tmp);
-    return strlen(buf);
+    return -1;
 }


_______________________________________________
klik-devel mailing list
klik-devel@kde.org
https://mail.kde.org/mailman/listinfo/klik-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic