diff options
author | jkh <jkh@FreeBSD.org> | 1995-12-28 04:51:40 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-12-28 04:51:40 +0000 |
commit | 3cebea6eb99141a9d64c9f481cdb7d89a6a62066 (patch) | |
tree | b652314a55bb820ea193c1b3bddb9cfe43941d67 /games | |
parent | d046612fefbc20db688fafd95c0cb335439c146a (diff) | |
download | FreeBSD-src-3cebea6eb99141a9d64c9f481cdb7d89a6a62066.zip FreeBSD-src-3cebea6eb99141a9d64c9f481cdb7d89a6a62066.tar.gz |
Truncate the fgets() return properly.
Diffstat (limited to 'games')
-rw-r--r-- | games/sail/pl_main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/games/sail/pl_main.c b/games/sail/pl_main.c index e921321..02faa79 100644 --- a/games/sail/pl_main.c +++ b/games/sail/pl_main.c @@ -201,8 +201,9 @@ reprint: (void) fgets(captain, sizeof captain, stdin); if (!*captain) (void) strcpy(captain, "no name"); + else + captain[strlen(captain) - 1] = '\0'; } - captain[sizeof captain - 1] = '\0'; Write(W_CAPTAIN, ms, 1, (int)captain, 0, 0, 0); for (n = 0; n < 2; n++) { char buf[10]; |