/*
* dir.c - Directory handling code. Part of the Linux-NTFS project.
*
- * Copyright (c) 2002 Anton Altaparmakov
+ * Copyright (c) 2002-2003 Anton Altaparmakov
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
return -1;
}
+ if (!(dir_ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)) {
+ errno = ENOTDIR;
+ return -1;
+ }
+
vol = dir_ni->vol;
Dprintf("Entering for inode 0x%Lx, *pos 0x%Lx.\n",
done:
if (bmp_na)
ntfs_attr_close(bmp_na);
- ntfs_attr_close(ia_na);
+ if (ia_na)
+ ntfs_attr_close(ia_na);
#ifdef DEBUG
if (!rc)
Dprintf("EOD, *pos 0x%Lx, returning 0.\n", (long long)*pos);
ntfs_attr_put_search_ctx(ctx);
if (bmp_na)
ntfs_attr_close(bmp_na);
- ntfs_attr_close(ia_na);
+ if (ia_na)
+ ntfs_attr_close(ia_na);
errno = eo;
return -1;
}