use strdup appropriately
This commit is contained in:
parent
858c07d313
commit
e7bcd6bf17
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: dumprmt.c,v 1.22 2001/02/04 21:33:19 christos Exp $ */
|
/* $NetBSD: dumprmt.c,v 1.23 2001/05/26 07:48:15 lukem Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1980, 1993
|
* Copyright (c) 1980, 1993
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)dumprmt.c 8.3 (Berkeley) 4/28/95";
|
static char sccsid[] = "@(#)dumprmt.c 8.3 (Berkeley) 4/28/95";
|
||||||
#else
|
#else
|
||||||
__RCSID("$NetBSD: dumprmt.c,v 1.22 2001/02/04 21:33:19 christos Exp $");
|
__RCSID("$NetBSD: dumprmt.c,v 1.23 2001/05/26 07:48:15 lukem Exp $");
|
||||||
#endif
|
#endif
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
|
@ -103,11 +103,8 @@ rmthost(host)
|
||||||
char *host;
|
char *host;
|
||||||
{
|
{
|
||||||
|
|
||||||
rmtpeer = malloc(strlen(host) + 1);
|
if ((rmtpeer = strdup(host)) == NULL)
|
||||||
if (rmtpeer)
|
err(1, "strdup");
|
||||||
strcpy(rmtpeer, host);
|
|
||||||
else
|
|
||||||
rmtpeer = host;
|
|
||||||
signal(SIGPIPE, rmtconnaborted);
|
signal(SIGPIPE, rmtconnaborted);
|
||||||
rmtgetconn();
|
rmtgetconn();
|
||||||
if (rmtape < 0)
|
if (rmtape < 0)
|
||||||
|
@ -141,7 +138,7 @@ rmtgetconn()
|
||||||
errx(1, "who are you?");
|
errx(1, "who are you?");
|
||||||
}
|
}
|
||||||
if ((name = strdup(pwd->pw_name)) == NULL)
|
if ((name = strdup(pwd->pw_name)) == NULL)
|
||||||
err(1, "malloc");
|
err(1, "strdup");
|
||||||
if ((cp = strchr(rmtpeer, '@')) != NULL) {
|
if ((cp = strchr(rmtpeer, '@')) != NULL) {
|
||||||
tuser = rmtpeer;
|
tuser = rmtpeer;
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
|
|
Loading…
Reference in New Issue