Module Name:    src
Committed By:   dholland
Date:           Mon Mar 29 02:46:05 UTC 2010

Modified Files:
        src/games/gomoku: main.c

Log Message:
Allow saved game filenames up to PATH_MAX. From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/games/gomoku/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/gomoku/main.c
diff -u src/games/gomoku/main.c:1.20 src/games/gomoku/main.c:1.21
--- src/games/gomoku/main.c:1.20	Wed Aug 12 06:19:17 2009
+++ src/games/gomoku/main.c	Mon Mar 29 02:46:05 2010
@@ -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;
 				}

Reply via email to