bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

canonicalize-lgpl: set errno


From: Bruno Haible
Subject: canonicalize-lgpl: set errno
Date: Sun, 9 Sep 2007 16:34:23 +0200
User-agent: KMail/1.5.4

The 'canonicalize-lgpl' module should better not rely on malloc-posix or
realloc-posix, otherwise it adds extra complexity to the 'relocatable'
module family. Setting errno = ENOMEM is the more maintainable solution here.


2007-09-09  Bruno Haible  <address@hidden>

        * lib/canonicalize-lgpl.c (__realpath): Set errno to ENOMEM when
        malloc or realloc fails.

*** lib/canonicalize-lgpl.c     9 Jun 2007 11:15:22 -0000       1.3
--- lib/canonicalize-lgpl.c     9 Sep 2007 14:30:44 -0000
***************
*** 135,141 ****
      {
        rpath = malloc (path_max);
        if (rpath == NULL)
!       return NULL;
      }
    else
      rpath = resolved;
--- 135,146 ----
      {
        rpath = malloc (path_max);
        if (rpath == NULL)
!       {
!         /* It's easier to set errno to ENOMEM than to rely on the
!            'malloc-posix' gnulib module.  */
!         errno = ENOMEM;
!         return NULL;
!       }
      }
    else
      rpath = resolved;
***************
*** 209,215 ****
                new_size += path_max;
              new_rpath = (char *) realloc (rpath, new_size);
              if (new_rpath == NULL)
!               goto error;
              rpath = new_rpath;
              rpath_limit = rpath + new_size;
  
--- 214,225 ----
                new_size += path_max;
              new_rpath = (char *) realloc (rpath, new_size);
              if (new_rpath == NULL)
!               {
!                 /* It's easier to set errno to ENOMEM than to rely on the
!                    'realloc-posix' gnulib module.  */
!                 errno = ENOMEM;
!                 goto error;
!               }
              rpath = new_rpath;
              rpath_limit = rpath + new_size;
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]