From 366cce3858bfc67e91ae16e70eccd8a1072f5777 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 21 Mar 2004 13:19:06 +0000 Subject: [PATCH] Fix for mbsetup --- ChangeLog | 2 ++ mbsetup/m_farea.c | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f575c5b..1a027221 100644 --- a/ChangeLog +++ b/ChangeLog @@ -110,6 +110,8 @@ v0.51.2 06-Mar-2004 sync calls. In several menus that can change paths, a command to mbtask is given to reread filesystem tables when something is changed. + Fixed error if a file area is deleted that has an empty files + database. mbmon: Switched to use new filesystems command. diff --git a/mbsetup/m_farea.c b/mbsetup/m_farea.c index 217d9325..686a8f55 100644 --- a/mbsetup/m_farea.c +++ b/mbsetup/m_farea.c @@ -371,12 +371,13 @@ int EditFileRec(int Area) * Attempt to disable this area, but check first. */ if ((fp = fopen(temp, "r"))) { - fread(&fdbhdr, sizeof(fdbhdr), 1, fp); - fseek(fp, 0, SEEK_END); - files = ((ftell(fp) - fdbhdr.hdrsize) / fdbhdr.recsize); - if (files) { - errmsg("There are stil %d files in this area", files); - Available = TRUE; + if (fread(&fdbhdr, sizeof(fdbhdr), 1, fp) == 1) { + fseek(fp, 0, SEEK_END); + files = ((ftell(fp) - fdbhdr.hdrsize) / fdbhdr.recsize); + if (files) { + errmsg("There are stil %d files in this area", files); + Available = TRUE; + } } fclose(fp); }