aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/playerdb.c
diff options
context:
space:
mode:
authorMarkus Uhlin <markus@nifty-networks.net>2024-01-06 12:30:54 +0100
committerMarkus Uhlin <markus@nifty-networks.net>2024-01-06 12:30:54 +0100
commit458b51ab2aea181c7b68f8a7c75964679721ad16 (patch)
tree71a7bba40ea896371714c6c454660a0f03e24db2 /FICS/playerdb.c
parentbb9f36f5946d5d4e918425f4258fca9a79a2fa61 (diff)
Check the return of fgets()
Diffstat (limited to 'FICS/playerdb.c')
-rw-r--r--FICS/playerdb.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index 9d9b59c..54c403d 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -356,8 +356,8 @@ ReadV1PlayerFmt(int p, player *pp, FILE *fp, char *file, int version)
/*
* Name
*/
- (void)fgets(tmp2, sizeof tmp2, fp);
- if (strcmp(tmp2, "NONE\n")) {
+ if (fgets(tmp2, sizeof tmp2, fp) != NULL &&
+ strcmp(tmp2, "NONE\n") != 0) {
tmp2[strcspn(tmp2, "\n")] = '\0';
pp->name = xstrdup(tmp2);
} else {
@@ -367,8 +367,8 @@ ReadV1PlayerFmt(int p, player *pp, FILE *fp, char *file, int version)
/*
* Full name
*/
- (void)fgets(tmp2, sizeof tmp2, fp);
- if (strcmp(tmp2, "NONE\n")) {
+ if (fgets(tmp2, sizeof tmp2, fp) != NULL &&
+ strcmp(tmp2, "NONE\n") != 0) {
tmp2[strcspn(tmp2, "\n")] = '\0';
pp->fullName = xstrdup(tmp2);
} else {
@@ -378,8 +378,8 @@ ReadV1PlayerFmt(int p, player *pp, FILE *fp, char *file, int version)
/*
* Password
*/
- (void)fgets(tmp2, sizeof tmp2, fp);
- if (strcmp(tmp2, "NONE\n")) {
+ if (fgets(tmp2, sizeof tmp2, fp) != NULL &&
+ strcmp(tmp2, "NONE\n") != 0) {
tmp2[strcspn(tmp2, "\n")] = '\0';
pp->passwd = xstrdup(tmp2);
} else {
@@ -389,8 +389,8 @@ ReadV1PlayerFmt(int p, player *pp, FILE *fp, char *file, int version)
/*
* Email
*/
- (void)fgets(tmp2, sizeof tmp2, fp);
- if (strcmp(tmp2, "NONE\n")) {
+ if (fgets(tmp2, sizeof tmp2, fp) != NULL &&
+ strcmp(tmp2, "NONE\n") != 0) {
tmp2[strcspn(tmp2, "\n")] = '\0';
pp->emailAddress = xstrdup(tmp2);
} else {