On Thu, Nov 29, 2007 at 06:06:01PM +0600, Slava Semushin wrote: > 29.11.07, Денис Смирнов написал(а): > [...] > > KAS> В glibc нету strlcpy и strlcat. В нашем glibc приложен патч > > KAS> glibc-2.5-obsd-alt-strlcpy-strlcat.patch > > KAS> Учитывая что мэнтэйнер glibc работает в redhat, трудно ожидать в их glibc > > KAS> этот патч ;) > > Место его работы IMHO тут абсолютно непричем. > > > Мне жутко интересно что мешает мантейнеру glibc включить этот патч. > > Всё просто: он против. > > Цитата с http://en.wikipedia.org/wiki/Strlcpy: > > "Furthermore, some, including Ulrich Drepper, argue that strlcpy and > strlcat make truncation errors easier for a programmer to ignore and > thus can introduce more bugs than they remove;[2] consequently, these > functions have not been added to the GNU C Library." Забавно то, что эта позиция не помешала ему наплодить в самом glibc достаточно кода, неправильно использующего asprintf: 2001-12-06 Ulrich Drepper * libio/vasprintf.c (_IO_vasprintf): Free buffer on failure. * assert/assert.c: Check result of __asprintf call and don't use string if it failed. * assert/assert-perr.c: Likewise. * inet/rcmd.c: Likewise. * locale/programs/localedef.c (main): Check result of construct_output_path and exit if it failed. (construct_output_path): Check result of asprintf and mkdir calls and fail if they failed. * posix/getopt.c: Check result of __asprintf calls and fail if they failed. Patch by Dmitry V. Levin . 2004-06-14 Andreas Schwab * stdio-common/psignal.c (psignal): Don't use BUF when asprintf failed. 2004-05-07 Dmitry V. Levin * argp/argp-help.c (__argp_error, __argp_failure): Check result of __asprintf call and don't use string if it failed. * stdio-common/psignal.c (psignal): Likewise. * locale/programs/localedef.c (more_help): Likewise. * resolv/res_hconf.c (arg_service_list, arg_trimdomain_list, arg_bool, parse_line): Check result of __asprintf calls and don't use string if they failed. * sunrpc/svc_simple.c (registerrpc, universal): Likewise. * elf/ldconfig.c (parse_conf_include): Check result of __asprintf call and exit if it failed. -- ldv