diff options
author | Michael Meeks <michael.meeks@novell.com> | 2011-05-04 20:27:43 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2011-05-04 20:27:43 +0100 |
commit | 2cffe9a5f5343fcb73c08076a5ff9ddfaf6ac369 (patch) | |
tree | 293f42e074e18fdde5e279189530f6ca1ce61a8e /desktop/unx | |
parent | de6e29578b97b799880de13882f1b60b3efdb600 (diff) |
fix fdo#36838 by avoiding -L argument to pagein
Diffstat (limited to 'desktop/unx')
-rw-r--r-- | desktop/unx/source/args.c | 8 | ||||
-rwxr-xr-x | desktop/unx/source/start.c | 42 |
2 files changed, 32 insertions, 18 deletions
diff --git a/desktop/unx/source/args.c b/desktop/unx/source/args.c index 0f47f791d5eb..d69fe62e2466 100644 --- a/desktop/unx/source/args.c +++ b/desktop/unx/source/args.c @@ -61,10 +61,10 @@ static struct { { "minimized", 0, 1, 0, 0, NULL }, /* pagein bits */ - { "writer", 0, 0, 0, 0, "@pagein-writer" }, - { "calc", 0, 0, 0, 0, "@pagein-calc" }, - { "draw", 0, 0, 0, 0, "@pagein-draw" }, - { "impress", 0, 0, 0, 0, "@pagein-impress" }, + { "writer", 0, 0, 0, 0, "pagein-writer" }, + { "calc", 0, 0, 0, 0, "pagein-calc" }, + { "draw", 0, 0, 0, 0, "pagein-draw" }, + { "impress", 0, 0, 0, 0, "pagein-impress" }, /* nothing much */ { "version", 0, 1, 1, 1, NULL }, diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c index e81cd6129d0a..b3042f75ea24 100755 --- a/desktop/unx/source/start.c +++ b/desktop/unx/source/start.c @@ -728,6 +728,24 @@ system_checks( void ) /* re-use the pagein code */ extern int pagein_execute (int argc, char **argv); +#define REL_PATH "/../basis-link/program" +static char *build_pagein_path (Args *args, const char *pagein_name) +{ + char *path; + rtl_String *app_path; + + app_path = ustr_to_str (args->pAppPath); + path = malloc (app_path->length + strlen (pagein_name) + sizeof (REL_PATH) + 8); + strcpy (path, "@"); + strcpy (path + 1, rtl_string_getStr (app_path)); + strcat (path, "/../basis-link/program/"); + strcat (path, pagein_name); + + rtl_string_release( app_path ); + + return path; +} + void exec_pagein (Args *args) { @@ -735,24 +753,20 @@ exec_pagein (Args *args) #ifdef MACOSX (void)args; #else - char *argv[5]; - rtl_String *app_path; - - app_path = ustr_to_str (args->pAppPath); + char *argv[3]; + /* don't use -L - since that does a chdir that breaks relative paths */ argv[0] = "dummy-pagein"; - argv[1] = malloc (app_path->length + sizeof ("-L/../basis-link/program") + 2); - strcpy (argv[1], "-L"); - strcat (argv[1], app_path->buffer); - strcat (argv[1], "/../basis-link/program"); - argv[2] = "@pagein-common"; - argv[3] = (char *)args->pPageinType; - argv[4] = NULL; - - rtl_string_release( app_path ); + argv[1] = build_pagein_path (args, "pagein-common"); + if (args->pPageinType) { + argv[2] = build_pagein_path (args, args->pPageinType); + } else + argv[2] = NULL; - pagein_execute (args->pPageinType ? 4 : 3, argv); + pagein_execute (args->pPageinType ? 3 : 2, argv); + if (argv[2]) + free (argv[2]); free (argv[1]); #endif } |