From 782dcb6ba3b26f683117b3ff2ae90ceb78d25a66 Mon Sep 17 00:00:00 2001 From: Paul Janzen Date: Sun, 4 Feb 2001 02:17:55 +0000 Subject: Use strdup() --- games/snake/snscore.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'games') 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++; } } -- cgit v1.2.3