summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-07-25 00:33:30 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-25 00:33:30 +0100
commitae2836692f7e5ed96fdf6d5284ec3bdfaca024ab (patch)
tree41b1212aefac9f2440028f797cf9f558f9ee6297 /meta
parentff0e858780c24f34bdb92ed3ae9f93e77be0f6c2 (diff)
downloadpoky-ae2836692f7e5ed96fdf6d5284ec3bdfaca024ab.tar.gz
pseudo: Fix path length issues and resulting chdir issues
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/packages/pseudo/pseudo/data-as-env.patch72
-rw-r--r--meta/packages/pseudo/pseudo_git.bb2
2 files changed, 64 insertions, 10 deletions
diff --git a/meta/packages/pseudo/pseudo/data-as-env.patch b/meta/packages/pseudo/pseudo/data-as-env.patch
index 14473cc187..6cef1b316b 100644
--- a/meta/packages/pseudo/pseudo/data-as-env.patch
+++ b/meta/packages/pseudo/pseudo/data-as-env.patch
@@ -11,6 +11,7 @@ JL (23/07/10)
11Updates to include lock/log/socket/pid files 11Updates to include lock/log/socket/pid files
12 12
13RP (24/07/10) 13RP (24/07/10)
14
14Index: git/pseudo.h 15Index: git/pseudo.h
15=================================================================== 16===================================================================
16--- git.orig/pseudo.h 2010-07-24 00:28:35.762423800 +0100 17--- git.orig/pseudo.h 2010-07-24 00:28:35.762423800 +0100
@@ -232,7 +233,7 @@ Index: git/pseudo.c
232Index: git/pseudo_client.c 233Index: git/pseudo_client.c
233=================================================================== 234===================================================================
234--- git.orig/pseudo_client.c 2010-07-24 10:03:51.933588401 +0100 235--- git.orig/pseudo_client.c 2010-07-24 10:03:51.933588401 +0100
235+++ git/pseudo_client.c 2010-07-24 10:49:22.922336916 +0100 236+++ git/pseudo_client.c 2010-07-25 00:30:29.152364992 +0100
236@@ -359,6 +359,7 @@ 237@@ -359,6 +359,7 @@
237 FILE *fp; 238 FILE *fp;
238 extern char **environ; 239 extern char **environ;
@@ -266,14 +267,47 @@ Index: git/pseudo_client.c
266 pseudo_debug(2, "read new pid file: %d\n", server_pid); 267 pseudo_debug(2, "read new pid file: %d\n", server_pid);
267 /* at this point, we should have a new server_pid */ 268 /* at this point, we should have a new server_pid */
268 return 0; 269 return 0;
269@@ -535,10 +542,19 @@ 270@@ -407,6 +414,8 @@
271 char **new_environ;
272 int args;
273 int fd;
274+ int pseudo_prefix_fd;
275+ char *pseudo_path;
276
277 pseudo_new_pid();
278 base_args[0] = "bin/pseudo";
279@@ -439,9 +448,21 @@
280 } else {
281 argv = base_args;
282 }
283- if (fchdir(pseudo_dir_fd)) {
284+
285+
286+ pseudo_path = pseudo_prefix_path(NULL);
287+ if (pseudo_path) {
288+ pseudo_prefix_fd = open(pseudo_path, O_RDONLY);
289+ pseudo_prefix_fd = pseudo_fd(pseudo_prefix_fd, MOVE_FD);
290+ free(pseudo_path);
291+ } else {
292+ pseudo_diag("No prefix available to to find server.\n");
293+ exit(1);
294+ }
295+
296+ if (fchdir(pseudo_prefix_fd)) {
297 pseudo_diag("Couldn't change to server dir [%d]: %s\n",
298- pseudo_dir_fd, strerror(errno));
299+ pseudo_prefix_fd, strerror(errno));
300 }
301 /* close any higher-numbered fds which might be open,
302 * such as sockets. We don't have to worry about 0 and 1;
303@@ -535,10 +556,17 @@
270 304
271 static int 305 static int
272 client_connect(void) { 306 client_connect(void) {
273+ char *socketfile = pseudo_get_socketfile(); 307+ char *socketfile = pseudo_get_socketfile();
274 /* we have a server pid, is it responsive? */ 308 /* we have a server pid, is it responsive? */
275- struct sockaddr_un sun = { AF_UNIX, PSEUDO_SOCKET }; 309- struct sockaddr_un sun = { AF_UNIX, PSEUDO_SOCKET };
276+ struct sockaddr_un sun = { AF_UNIX, "" }; 310+ struct sockaddr_un sun = { AF_UNIX, "pseudo.socket" };
277 int cwd_fd; 311 int cwd_fd;
278 312
279+ if (!socketfile) { 313+ if (!socketfile) {
@@ -282,12 +316,10 @@ Index: git/pseudo_client.c
282+ return 1; 316+ return 1;
283+ } 317+ }
284+ 318+
285+ strncpy(sun.sun_path, socketfile, sizeof(sun.sun_path) - 1);
286+
287 connect_fd = socket(PF_UNIX, SOCK_STREAM, 0); 319 connect_fd = socket(PF_UNIX, SOCK_STREAM, 0);
288 connect_fd = pseudo_fd(connect_fd, MOVE_FD); 320 connect_fd = pseudo_fd(connect_fd, MOVE_FD);
289 if (connect_fd == -1) { 321 if (connect_fd == -1) {
290@@ -564,7 +580,7 @@ 322@@ -564,7 +592,7 @@
291 return 1; 323 return 1;
292 } 324 }
293 if (connect(connect_fd, (struct sockaddr *) &sun, sizeof(sun)) == -1) { 325 if (connect(connect_fd, (struct sockaddr *) &sun, sizeof(sun)) == -1) {
@@ -296,7 +328,7 @@ Index: git/pseudo_client.c
296 close(connect_fd); 328 close(connect_fd);
297 if (fchdir(cwd_fd) == -1) { 329 if (fchdir(cwd_fd) == -1) {
298 pseudo_diag("return to previous directory failed: %s\n", 330 pseudo_diag("return to previous directory failed: %s\n",
299@@ -588,6 +604,7 @@ 331@@ -588,6 +616,7 @@
300 FILE *fp; 332 FILE *fp;
301 server_pid = 0; 333 server_pid = 0;
302 int cwd_fd; 334 int cwd_fd;
@@ -304,7 +336,7 @@ Index: git/pseudo_client.c
304 336
305 /* avoid descriptor leak, I hope */ 337 /* avoid descriptor leak, I hope */
306 if (connect_fd >= 0) { 338 if (connect_fd >= 0) {
307@@ -604,7 +621,12 @@ 339@@ -604,7 +633,12 @@
308 return 1; 340 return 1;
309 } 341 }
310 if (fchdir(pseudo_dir_fd) != 1) { 342 if (fchdir(pseudo_dir_fd) != 1) {
@@ -318,7 +350,7 @@ Index: git/pseudo_client.c
318 if (fchdir(cwd_fd) == -1) { 350 if (fchdir(cwd_fd) == -1) {
319 pseudo_diag("return to previous directory failed: %s\n", 351 pseudo_diag("return to previous directory failed: %s\n",
320 strerror(errno)); 352 strerror(errno));
321@@ -619,6 +641,7 @@ 353@@ -619,6 +653,7 @@
322 pseudo_debug(1, "Opened server PID file, but didn't get a pid.\n"); 354 pseudo_debug(1, "Opened server PID file, but didn't get a pid.\n");
323 } 355 }
324 fclose(fp); 356 fclose(fp);
@@ -326,3 +358,25 @@ Index: git/pseudo_client.c
326 } 358 }
327 if (server_pid) { 359 if (server_pid) {
328 if (kill(server_pid, 0) == -1) { 360 if (kill(server_pid, 0) == -1) {
361@@ -710,7 +745,7 @@
362 pseudo_msg_t *ack;
363 char *pseudo_path;
364
365- pseudo_path = pseudo_prefix_path(NULL);
366+ pseudo_path = pseudo_data_path(NULL);
367 if (pseudo_dir_fd == -1) {
368 if (pseudo_path) {
369 pseudo_dir_fd = open(pseudo_path, O_RDONLY);
370Index: git/pseudo_wrappers.c
371===================================================================
372--- git.orig/pseudo_wrappers.c 2010-07-25 00:21:35.263587003 +0100
373+++ git/pseudo_wrappers.c 2010-07-25 00:29:03.052345996 +0100
374@@ -180,7 +180,7 @@
375 * value for cwd.
376 */
377 pseudo_client_reset();
378- pseudo_path = pseudo_prefix_path(NULL);
379+ pseudo_path = pseudo_data_path(NULL);
380 if (pseudo_dir_fd == -1) {
381 if (pseudo_path) {
382 pseudo_dir_fd = open(pseudo_path, O_RDONLY);
diff --git a/meta/packages/pseudo/pseudo_git.bb b/meta/packages/pseudo/pseudo_git.bb
index a06e87ac9c..9efed11fbf 100644
--- a/meta/packages/pseudo/pseudo_git.bb
+++ b/meta/packages/pseudo/pseudo_git.bb
@@ -6,7 +6,7 @@ LICENSE = "LGPL2.1"
6DEPENDS = "sqlite3" 6DEPENDS = "sqlite3"
7 7
8PV = "0.0+git${SRCPV}" 8PV = "0.0+git${SRCPV}"
9PR = "r7" 9PR = "r10"
10 10
11SRC_URI = "git://github.com/wrpseudo/pseudo.git;protocol=git \ 11SRC_URI = "git://github.com/wrpseudo/pseudo.git;protocol=git \
12 file://tweakflags.patch \ 12 file://tweakflags.patch \