diff options
-rw-r--r-- | sbin/fsck_msdos/dir.c | 15 | ||||
-rw-r--r-- | sbin/fsck_msdos/ext.h | 4 |
2 files changed, 10 insertions, 9 deletions
diff --git a/sbin/fsck_msdos/dir.c b/sbin/fsck_msdos/dir.c index 0459a7f96d2..90634613781 100644 --- a/sbin/fsck_msdos/dir.c +++ b/sbin/fsck_msdos/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.23 2014/06/18 17:29:07 tobias Exp $ */ +/* $OpenBSD: dir.c,v 1.24 2014/07/09 18:32:34 tobias Exp $ */ /* $NetBSD: dir.c,v 1.11 1997/10/17 11:19:35 ws Exp $ */ /* @@ -147,7 +147,7 @@ freeDirTodo(struct dirTodoNode *dt) /* * The stack of unread directories */ -struct dirTodoNode *pendingDirectories = NULL; +static struct dirTodoNode *pendingDirectories = NULL; /* * Return the full pathname for a directory entry. @@ -203,7 +203,7 @@ static char longName[DOSLONGNAMELEN] = ""; static u_char *buffer = NULL; static u_char *delbuf = NULL; -struct dosDirEntry *rootDir; +static struct dosDirEntry *rootDir; static struct dosDirEntry *lostDir; /* @@ -223,14 +223,14 @@ resetDosDirSection(struct bootblock *boot, struct fatEntry *fat) || !(delbuf = malloc(b2)) || !(rootDir = newDosDirEntry())) { xperror("No space for directory"); - return (FSFATAL); + goto fail; } (void)memset(rootDir, 0, sizeof *rootDir); if (boot->flags & FAT32) { if (boot->RootCl < CLUST_FIRST || boot->RootCl >= boot->NumClusters) { pfatal("Root directory starts with cluster out of range(%u)\n", boot->RootCl); - return (FSFATAL); + goto fail; } cl = fat[boot->RootCl].next; if (cl < CLUST_FIRST @@ -243,7 +243,7 @@ resetDosDirSection(struct bootblock *boot, struct fatEntry *fat) rsrvdcltype(cl)); else { pfatal("Root directory doesn't start a cluster chain\n"); - return (FSFATAL); + goto fail; } if (ask(1, "Fix")) { fat[boot->RootCl].next = CLUST_FREE; @@ -257,6 +257,9 @@ resetDosDirSection(struct bootblock *boot, struct fatEntry *fat) } return (ret); +fail: + finishDosDirSection(); + return (FSFATAL); } /* diff --git a/sbin/fsck_msdos/ext.h b/sbin/fsck_msdos/ext.h index 72dc8804977..89529a65937 100644 --- a/sbin/fsck_msdos/ext.h +++ b/sbin/fsck_msdos/ext.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ext.h,v 1.11 2014/06/16 18:33:33 tobias Exp $ */ +/* $OpenBSD: ext.h,v 1.12 2014/07/09 18:32:34 tobias Exp $ */ /* $NetBSD: ext.h,v 1.5 1997/10/17 11:19:48 ws Exp $ */ /* @@ -46,8 +46,6 @@ extern int rdonly; /* device is opened read only (supersedes above) */ extern struct disklabel lab; -extern struct dosDirEntry *rootDir; - /* * function declarations */ |