summaryrefslogtreecommitdiff
path: root/games/snake
diff options
context:
space:
mode:
authorPaul Janzen <pjanzen@cvs.openbsd.org>2001-02-04 02:17:55 +0000
committerPaul Janzen <pjanzen@cvs.openbsd.org>2001-02-04 02:17:55 +0000
commit782dcb6ba3b26f683117b3ff2ae90ceb78d25a66 (patch)
tree2b5c332b76133a28e19c8c75829f2a872e3612a0 /games/snake
parent42df3673ec79a02f2eabe4da012bf880b0134df3 (diff)
Use strdup()
Diffstat (limited to 'games/snake')
-rw-r--r--games/snake/snscore.c10
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++;
}
}