Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/gomoku Allow saved game filenames up to PATH_MAX. From...
details: https://anonhg.NetBSD.org/src/rev/c9c3fcf04c19
branches: trunk
changeset: 753442:c9c3fcf04c19
user: dholland <dholland%NetBSD.org@localhost>
date: Mon Mar 29 02:46:05 2010 +0000
description:
Allow saved game filenames up to PATH_MAX. From OpenBSD.
diffstat:
games/gomoku/main.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (54 lines):
diff -r 57a78c57c00e -r c9c3fcf04c19 games/gomoku/main.c
--- a/games/gomoku/main.c Mon Mar 29 02:34:50 2010 +0000
+++ b/games/gomoku/main.c Mon Mar 29 02:46:05 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.20 2009/08/12 06:19:17 dholland Exp $ */
+/* $NetBSD: main.c,v 1.21 2010/03/29 02:46:05 dholland Exp $ */
/*
* Copyright (c) 1994
@@ -42,12 +42,13 @@
#if 0
static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: main.c,v 1.20 2009/08/12 06:19:17 dholland Exp $");
+__RCSID("$NetBSD: main.c,v 1.21 2010/03/29 02:46:05 dholland Exp $");
#endif
#endif /* not lint */
#include <curses.h>
#include <err.h>
+#include <limits.h>
#include <signal.h>
#include <stdarg.h>
#include <stdlib.h>
@@ -88,6 +89,7 @@
main(int argc, char **argv)
{
char buf[128];
+ char fname[PATH_MAX];
int color, curmove, i, ch;
int input[2];
static const char *const fmt[2] = {
@@ -255,8 +257,8 @@
FILE *fp;
ask("save file name? ");
- (void)get_line(buf, sizeof(buf));
- if ((fp = fopen(buf, "w")) == NULL) {
+ (void)get_line(fname, sizeof(fname));
+ if ((fp = fopen(fname, "w")) == NULL) {
misclog("cannot create save file");
goto getinput;
}
@@ -314,8 +316,8 @@
FILE *fp;
ask("save file name? ");
- (void)get_line(buf, sizeof(buf));
- if ((fp = fopen(buf, "w")) == NULL) {
+ (void)get_line(fname, sizeof(fname));
+ if ((fp = fopen(fname, "w")) == NULL) {
misclog("cannot create save file");
goto replay;
}
Home |
Main Index |
Thread Index |
Old Index