]> git.pld-linux.org Git - packages/libreoffice.git/commitdiff
- readlink(2) returns bytes copied and -1 on error, at least our glibc
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 18 Mar 2007 16:45:30 +0000 (16:45 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    openoffice.org-nsplugin-path.diff -> 1.2

openoffice.org-nsplugin-path.diff

index bb55cb165adc2b81b1be05b761db1480d30e5dfe..51336708c054be0547479079e954a45795f710a0 100644 (file)
@@ -1,11 +1,6 @@
-Index: extensions/source/nsplugin/source/so_env.cxx
-===================================================================
-RCS file: /cvs/util/extensions/source/nsplugin/source/so_env.cxx,v
-retrieving revision 1.6
-diff -u -p -u -r1.6 so_env.cxx
---- extensions/source/nsplugin/source/so_env.cxx       8 Sep 2005 19:40:59 -0000       1.6
-+++ extensions/source/nsplugin/source/so_env.cxx       20 Oct 2005 12:32:16 -0000
-@@ -36,6 +36,7 @@
+--- extensions/source/nsplugin/source/so_env.cxx.orig  2007-03-18 18:43:48.259831000 +0200
++++ extensions/source/nsplugin/source/so_env.cxx       2007-03-18 18:44:09.670316347 +0200
+@@ -39,6 +39,7 @@
  #ifdef UNIX
  #include <sys/types.h>
  #include <strings.h>
@@ -13,7 +8,7 @@ diff -u -p -u -r1.6 so_env.cxx
  #if defined(SOLARIS) && !defined(__GNUC__)
  #include <varargs.h>
  #else
-@@ -122,6 +123,80 @@ restoreUTF8(char *pPath)
+@@ -125,6 +126,82 @@
      return 0;
  }
  
@@ -66,11 +61,13 @@ diff -u -p -u -r1.6 so_env.cxx
 +
 +      if (!(clobber = strstr (libFileName, SEARCH_SUFFIX)))
 +      {
-+              if (readlink(libFileName, realFileName, NPP_PATH_MAX) != 0)
++              ssize_t len = readlink(libFileName, realFileName, NPP_PATH_MAX);
++              if (len == -1)
 +              {
 +                  fprintf (stderr, "Couldn't read link '%s'\n", libFileName);
 +                      return 1;
 +              }
++              realFileName[len] = '\0';
 +              if (!(clobber = strstr (realFileName, "/program/libnpsoplug")))
 +              {
 +                   fprintf (stderr, "Couldn't find suffix in '%s'\n", realFileName);
@@ -94,7 +91,7 @@ diff -u -p -u -r1.6 so_env.cxx
  // *aResult points the static string holding "/opt/staroffice8"
  int findReadSversion(void** aResult, int bWnt, const char* tag, const char* entry)
  {
-@@ -134,6 +209,12 @@ int findReadSversion(void** aResult, int
+@@ -137,9 +214,22 @@
      // Filename of lnk file, eg. "soffice"
      char lnkFileName[NPP_PATH_MAX] = {0};
      char* pTempZero = NULL;
@@ -105,6 +102,17 @@ diff -u -p -u -r1.6 so_env.cxx
 +
 +    /* .. now in $HOME */
      sprintf(lnkFileName, "%s/.mozilla/plugins/libnpsoplugin%s", getenv("HOME"), SAL_DLLEXTENSION);
-     if ((0 > readlink(lnkFileName, realFileName, NPP_PATH_MAX)) ||
-        (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION))))
-
+-    if ((0 > readlink(lnkFileName, realFileName, NPP_PATH_MAX)) ||
+-       (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION))))
++      ssize_t len = readlink(lnkFileName, realFileName, NPP_PATH_MAX);
++      if (-1 == len)
++      {
++        *realFileName = 0;
++        return -1;
++      }
++      realFileName[len] = '\0';
++
++      if (NULL == (pTempZero = strstr(realFileName, "/program/libnpsoplugin" SAL_DLLEXTENSION))))
+     {
+         *realFileName = 0;
+         return -1;
This page took 0.0367 seconds and 4 git commands to generate.