Re: strlcpy missing on Linux



Nils O. Selåsdal wrote:
Thomas Maier-Komor wrote:
Hi,

does anybody know if there is any specific reason, why Linux's glibc is
missing strlcpy?
Follow the threads at
http://sources.redhat.com/ml/libc-alpha/2000-08/msg00053.html
http://sources.redhat.com/ml/libc-alpha/2002-01/msg00001.html

Thanks. That was a little bit enlightening. I didn't read everything,
but I can say that I totally disagree with the opinion that a program
always has to know how long its strings are.

Reason:
Reading from standard input, you will never be able to determine how
much data you will get. In this case strlcpy can ease the implementation
because it is a) safe, b) tells you when it runs out of memory, c) says
how much has been copied. So it is really convenient to implement an
exception mechanism that supports starting with a small buffer and
increasing it in size when necessary.

But I think this isn't the first time that Linux or glibc developers
know better how to solve problems that they don't have. Very sad.

Tom
.



Relevant Pages

  • Re: strlcpy missing on Linux
    ... Thomas Maier-Komor wrote: ... does anybody know if there is any specific reason, why Linux's glibc is ...
    (comp.unix.programmer)
  • Re: [SLE] SuSE 8.1 - Postfix 2.1.5 not building.
    ... On Friday 08 October 2004 14:17, Anders Johansson wrote: ... >> rpm. ... > That's not the only reason. ... The i686 glibc has the NPTL threading model, ...
    (SuSE)
  • Re: + fully-honor-vdso_enabled.patch added to -mm tree
    ... Oleg Nesterov wrote: ... I guess the reason is some magic in glibc. ... In the past there were problems where user code could not single-step ...
    (Linux-Kernel)
  • strtof
    ... undecalred variable, but strtod() ... Can't check my glibc version right now. ... Can someone tell me the reason? ... TIA ...
    (comp.os.linux.development.apps)