eglibc: replace the use of stpncpy with strncpy + manual termination (stpncpy is not available on darwin)

SVN-Revision: 14212
This commit is contained in:
Felix Fietkau 2009-01-26 19:49:26 +00:00
parent 15c76887b8
commit 0232808d14

View file

@ -30,6 +30,20 @@
#include <ctype.h>
#include <sys/types.h>
#include <sys/param.h>
@@ -998,9 +1002,10 @@ mkfile_output (struct commandline *cmd)
abort ();
temp = rindex (cmd->infile, '.');
cp = stpcpy (mkfilename, "Makefile.");
- if (temp != NULL)
- *((char *) stpncpy (cp, cmd->infile, temp - cmd->infile)) = '\0';
- else
+ if (temp != NULL) {
+ strncpy (cp, cmd->infile, temp - cmd->infile);
+ cp[temp - cmd->infile - 1] = '\0';
+ } else
stpcpy (cp, cmd->infile);
}
--- a/libc/sunrpc/rpc_scan.c
+++ b/libc/sunrpc/rpc_scan.c
@@ -39,7 +39,11 @@