readlink() patch

Egor Duda deo@logos-m.ru
Sun Sep 3 10:34:00 GMT 2000


Hi!

  linux man says about readlink():

========================================================================
readlink  places  the contents of the symbolic link path in the buffer
buf,  which  has size bufsiz. readlink does not append a NUL character
to   buf.   It   will  truncate  the  contents  (to a length of bufsiz
characters),  in  case  the  buffer  is  too  small to hold all of the 
contents.
========================================================================

susv2  is  rather  vague  on  this subject, but there's no "buffer too
small"  in  its  list  of  error  conditions.  i don't know what other
standards  say  about  readlink. this patch is to make cygwin readlink
behaving like linux one.

Egor.            mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19
readlink.ChangeLog
readlink.diff

-------------- next part --------------
2000-09-03  Egor Duda  <deo@logos-m.ru>

	* path.cc (readlink): Check if buffer length is positive.
	Truncate output to buffer length. Don't terminate buffer
	with '\0'.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: readlink.diff
Type: text/x-diff
Size: 898 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20000903/32507efb/attachment.bin>


More information about the Cygwin-patches mailing list