delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/12/23/08:25:52

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3E070ED9.123CC1B@phekda.freeserve.co.uk>
Date: Mon, 23 Dec 2002 13:25:45 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: djgpp: djgpp/src/libc/compat/unistd/_irdlink.c
References: <10212230558 DOT AA13014 AT clio DOT rice DOT edu>
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Charles Sandmann wrote:
> 
> > 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

Looks good to me. I'll give it some testing, if I have time.

> *** _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);

Thanks, bye, Rich =]

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


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