delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/12/23/01:00:13

From: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
Message-Id: <10212230558.AA13014@clio.rice.edu>
Subject: Re: djgpp: djgpp/src/libc/compat/unistd/_irdlink.c
To: djgpp-workers AT delorie DOT com
Date: Sun, 22 Dec 2002 23:58:51 -0600 (CST)
In-Reply-To: <3E05D780.5F779C84@phekda.freeserve.co.uk> from "Richard Dawe" at Dec 22, 2002 03:17:20 PM
X-Mailer: ELM [version 2.5 PL2]
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Are you sure this doesn't break symlinks? Symlinks are text files with
> newlines, so don't we need read rather than _read, to convert CRLFs to
> newlines? I would check this, but I don't want to do a 'cvs update', until
> I've hunted down some other bugs.

This is what I plan to do to fix it, but thought I would test first.
strpbrk is already pulled into the base image size by xsymlink.
Below should work on either \n or \r\n terminated lines (or even \r ...)
Sorry for the screwup

*** _irdlink.bak	Sat Dec 21 17:21:46 2002
--- _irdlink.c	Sun Dec 22 23:45:52 2002
*************** int __internal_readlink(const char * __p
*** 118,124 ****
     }
     
     data_buf = buf + _SYMLINK_PREFIX_LEN;
!    bytes_read = strchr(data_buf, '\n') - data_buf;
     if( (unsigned)bytes_read > __max ) 
       bytes_read = __max;
     memcpy(__buf, data_buf, bytes_read);
--- 118,124 ----
     }
     
     data_buf = buf + _SYMLINK_PREFIX_LEN;
!    bytes_read = strpbrk(data_buf, "\r\n") - data_buf;
     if( (unsigned)bytes_read > __max ) 
       bytes_read = __max;
     memcpy(__buf, data_buf, bytes_read);

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019