git://git.jankratochvil.net
/
ntfsprogs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
http://linux-ntfs.sourceforge.net/snapshots/ntfsprogs-200309071734.tar.bz2
[ntfsprogs.git]
/
libntfs
/
dir.c
diff --git
a/libntfs/dir.c
b/libntfs/dir.c
index
443322b
..
9abb792
100644
(file)
--- a/
libntfs/dir.c
+++ b/
libntfs/dir.c
@@
-1,7
+1,7
@@
/*
* dir.c - Directory handling code. Part of the Linux-NTFS project.
*
/*
* 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
*
* 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
@@
-612,6
+612,11
@@
int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
return -1;
}
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",
vol = dir_ni->vol;
Dprintf("Entering for inode 0x%Lx, *pos 0x%Lx.\n",
@@
-898,7
+903,8
@@
EOD:
done:
if (bmp_na)
ntfs_attr_close(bmp_na);
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);
#ifdef DEBUG
if (!rc)
Dprintf("EOD, *pos 0x%Lx, returning 0.\n", (long long)*pos);
@@
-916,7
+922,8
@@
err_out:
ntfs_attr_put_search_ctx(ctx);
if (bmp_na)
ntfs_attr_close(bmp_na);
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;
}
errno = eo;
return -1;
}