Changeset 379

Show
Ignore:
Timestamp:
10/14/09 18:02:25 (5 months ago)
Author:
cristy
Message:
 
Location:
ImageMagick/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ImageMagick/trunk/ChangeLog

    r370 r379  
     12009-10-14  6.5.7-0 Pino Toscano  <pino@kde...> 
     2  * ImageMagick fails to build in GNU/HURD due to absence of PATH_MAX. 
     3 
    142009-10-14  6.5.7-0 Cristy  <quetzlzacatenango@image...> 
    25  * Black channel is now set properly when resizing CMYKA images. 
  • ImageMagick/trunk/magick/utility.c

    r229 r379  
    906906  *path='\0'; 
    907907  cwd=getcwd(path,(unsigned long) extent); 
    908 #if defined(MAGICKCORE_HAVE_GETPID) && defined(MAGICKCORE_HAVE_READLINK) 
     908#if defined(MAGICKCORE_HAVE_GETPID) && defined(MAGICKCORE_HAVE_READLINK) && defined(PATH_MAX) 
    909909  { 
    910910    char 
    911911      link_path[MaxTextExtent], 
    912       real_path[PATH_MAX+1]; 
     912      execution_path[PATH_MAX+1]; 
    913913 
    914914    ssize_t 
     
    917917    (void) FormatMagickString(link_path,MaxTextExtent,"/proc/%ld/exe", 
    918918      (long) getpid()); 
    919     count=readlink(link_path,real_path,PATH_MAX); 
     919    count=readlink(link_path,execution_path,PATH_MAX); 
    920920    if (count == -1) 
    921921      { 
    922922        (void) FormatMagickString(link_path,MaxTextExtent,"/proc/%ld/file", 
    923923          (long) getpid()); 
    924         count=readlink(link_path,real_path,PATH_MAX); 
     924        count=readlink(link_path,execution_path,PATH_MAX); 
    925925      } 
    926926    if ((count > 0) && (count <= (ssize_t) PATH_MAX)) 
    927927      { 
    928         real_path[count]='\0'; 
    929         (void) CopyMagickString(path,real_path,extent); 
     928        execution_path[count]='\0'; 
     929        (void) CopyMagickString(path,execution_path,extent); 
    930930      } 
    931931  } 
     
    935935    char 
    936936      executable_path[PATH_MAX << 1], 
    937       real_path[PATH_MAX+1]; 
     937      execution_path[PATH_MAX+1]; 
    938938 
    939939    uint32_t 
     
    942942    length=sizeof(executable_path); 
    943943    if ((_NSGetExecutablePath(executable_path,&length) == 0) && 
    944         (realpath(executable_path,real_path) != (char *) NULL)) 
    945       (void) CopyMagickString(path,real_path,extent); 
     944        (realpath(executable_path,execution_path) != (char *) NULL)) 
     945      (void) CopyMagickString(path,execution_path,extent); 
    946946  } 
    947947#endif 
     
    962962#if defined(__WINDOWS__) 
    963963  NTGetExecutionPath(path,extent); 
     964#endif 
     965#if defined(__GNU__) 
     966  { 
     967    char 
     968      *program_name, 
     969      *execution_path; 
     970 
     971    long 
     972      count; 
     973 
     974    count=0; 
     975    execution_path=(char *) NULL; 
     976    program_name=program_invocation_name; 
     977    if (*program_invocation_name != '/') 
     978      { 
     979        size_t 
     980          extent; 
     981 
     982        extent=strlen(cwd)+strlen(program_name)+1; 
     983        program_name=AcquireQuantumMemory(extent,sizeof(*program_name)); 
     984        if (program_name == (char *) NULL) 
     985          program_name=program_invocation_name; 
     986        else 
     987          count=FormatMagickString(program_name,extent,"%s/%s",cwd, 
     988            program_invocation_name); 
     989      } 
     990    if (count != -1) 
     991      { 
     992        execution_path=realpath(program_name,NULL); 
     993        if (execution_path != (char *) NULL) 
     994          (void) CopyMagickString(path,execution_path,extent); 
     995      } 
     996    if (program_name != program_invocation_name) 
     997      program_name=(char *) RelinquishMagickMemory(program_name); 
     998    execution_path=(char *) RelinquishMagickMemory(execution_path); 
     999  } 
    9641000#endif 
    9651001  return(IsPathAccessible(path));