1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00

Fri Jun 28 07:27:10 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>

* string/strndup.c (strndup): Always terminate the string.
	* string/string.h (strndupa): Likewise.

Thu Jun 27 14:22:31 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* stdio/Makefile (routines): Add vscanf.
	* stdio-common/Makefile (routines): Remove vscanf.
	* stdio-common/vscanf.c: Move to ...
	* stdio/vscanf.c: here.

	* rpm/Makefile (headers, install-lib, install-lib.so,
	versioned, install-bin, install-sbin, install-data,
	install-others): Add $(-VARIABLE).
This commit is contained in:
Roland McGrath
1996-06-28 11:42:05 +00:00
parent 6dbe283756
commit de6b062321
5 changed files with 39 additions and 15 deletions

View File

@ -24,13 +24,14 @@ Cambridge, MA 02139, USA. */
char *
strndup (const char *s, size_t n)
{
size_t len = strnlen (s) + 1;
char *new = malloc (len);
size_t len = strnlen (s);
char *new = malloc (len + 1);
if (new == NULL)
return NULL;
memcpy (new, s, len);
new[len] = '\0';
return new;
}