mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* string/argz-stringify.c (__argz_stringify): Fix loop termination
conditions so as not to clobber the final '\0' when there is only one element in the vector.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2000-02-23 Roland McGrath <roland@baalperazim.frob.com>
|
||||||
|
|
||||||
|
* string/argz-stringify.c (__argz_stringify): Fix loop termination
|
||||||
|
conditions so as not to clobber the final '\0' when there is only one
|
||||||
|
element in the vector.
|
||||||
|
|
||||||
2000-03-09 Roland McGrath <roland@baalperazim.frob.com>
|
2000-03-09 Roland McGrath <roland@baalperazim.frob.com>
|
||||||
|
|
||||||
* io/sys/stat.h: Fix inverted sense of `defined __S_IFSOCK' test,
|
* io/sys/stat.h: Fix inverted sense of `defined __S_IFSOCK' test,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* Routines for dealing with '\0' separated arg vectors.
|
/* Routines for dealing with '\0' separated arg vectors.
|
||||||
Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
|
Copyright (C) 1995,96,97,2000 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Written by Miles Bader <miles@gnu.ai.mit.edu>
|
Written by Miles Bader <miles@gnu.org>
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public License as
|
modify it under the terms of the GNU Library General Public License as
|
||||||
@ -27,15 +27,14 @@ void
|
|||||||
__argz_stringify (char *argz, size_t len, int sep)
|
__argz_stringify (char *argz, size_t len, int sep)
|
||||||
{
|
{
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
do
|
while (1)
|
||||||
{
|
{
|
||||||
size_t part_len = strnlen (argz, len);
|
size_t part_len = strnlen (argz, len);
|
||||||
argz += part_len;
|
argz += part_len;
|
||||||
len -= part_len;
|
len -= part_len;
|
||||||
if (len == 0)
|
if (len-- <= 1) /* includes final '\0' we want to stop at */
|
||||||
break;
|
break;
|
||||||
*argz++ = sep;
|
*argz++ = sep;
|
||||||
}
|
}
|
||||||
while (--len > 0);
|
|
||||||
}
|
}
|
||||||
weak_alias (__argz_stringify, argz_stringify)
|
weak_alias (__argz_stringify, argz_stringify)
|
||||||
|
Reference in New Issue
Block a user