Applied patch to close PR#bin/199

Submitted by:	Toshihiro Kanda <candy@kgc.co.jp>
This commit is contained in:
Marc G. Fournier 1996-05-26 20:28:05 +00:00
parent 7439849253
commit bcb0ec3dcd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15912

View File

@ -316,11 +316,14 @@ appdstr(s, tp, len)
if ((m = malloc(strlen(s) + len + 1)) == NULL)
err("%s", strerror(errno));
for (mp = m, sp = s; *mp++ = *sp++;);
mp--;
if (*(mp - 1) == '\\')
--mp;
while ((ch = *mp++ = *tp++) && ch != '\n');
*mp = '\0';
memcpy(mp, tp, len);
mp[len] = '\0';
if (mp[len - 1] == '\n')
mp[len - 1] = '\0';
free(s);
return (m);