diff options
author | 2001-02-04 02:17:54 +0000 | |
---|---|---|
committer | 2001-02-04 02:17:54 +0000 | |
commit | 9a4806288e71ff166cfbed2576841927ef29ca1f (patch) | |
tree | 04dc444995d8bfeb6dea9a3649bc900f88800ad2 | |
parent | Tidying: change a constant to a #define, stop logging hostnames with the (diff) | |
download | wireguard-openbsd-9a4806288e71ff166cfbed2576841927ef29ca1f.tar.xz wireguard-openbsd-9a4806288e71ff166cfbed2576841927ef29ca1f.zip |
Use strdup()
-rw-r--r-- | games/snake/snscore.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/games/snake/snscore.c b/games/snake/snscore.c index 124a544dc1d..87a90056219 100644 --- a/games/snake/snscore.c +++ b/games/snake/snscore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snscore.c,v 1.1 1999/03/13 02:08:10 pjanzen Exp $ */ +/* $OpenBSD: snscore.c,v 1.2 2001/02/04 02:17:54 pjanzen Exp $ */ /* $NetBSD: snscore.c,v 1.5 1995/04/24 12:25:43 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)snscore.c 8.1 (Berkeley) 7/19/93"; #else -static char rcsid[] = "$OpenBSD: snscore.c,v 1.1 1999/03/13 02:08:10 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: snscore.c,v 1.2 2001/02/04 02:17:54 pjanzen Exp $"; #endif #endif /* not lint */ @@ -102,9 +102,9 @@ snscore(fd, topn) if (p == NULL) continue; q = p -> pw_name; - if ((players[noplayers].name = malloc(strlen(q) + 1)) == NULL) - errx(1, "malloc"); - strcpy(players[noplayers].name, q); + if ((players[noplayers].name = strdup(q)) == NULL) + err(1, "strdup"); + noplayers++; } } |