(strsave): Call strdup.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19642
dc483132-0cff-0310-8789-
dd5450dbe970
}
void
-#ifdef HAVE_STDARG_H
error(char *fmt, ...)
-#else
-/*VARARGS1*/
-error(fmt, va_alist)
- char *fmt;
- va_dcl
-#endif
{
va_list ap;
char buf[BUFSIZ], *cp = buf;
-#ifdef HAVE_STDARG_H
va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
errs++;
*cp++ = 1;
- (void) vsprintf(cp, fmt, ap);
+ (void) vsnprintf(cp, sizeof(buf) - (cp-buf), fmt, ap);
va_end(ap);
if (krem)
char *sp;
{
register char *ret;
-
- if((ret = (char *)malloc((unsigned) strlen(sp)+1)) == NULL) {
+
+ ret = strdup(sp);
+ if (ret == NULL) {
fprintf(stderr, "rcp: no memory for saving args\n");
exit(1);
}
- (void) strcpy(ret,sp);
- return(ret);
+ return ret;
}
#endif