| To: | xfs@xxxxxxxxxxx |
|---|---|
| Subject: | [PATCH 02/11] xfsprogs: Add ifdef dirent checks where it was missing |
| From: | Jan Tulak <jtulak@xxxxxxxxxx> |
| Date: | Mon, 17 Aug 2015 18:23:17 +0200 |
| Cc: | hch@xxxxxxxxxxxxx, Jan Tulak <jtulak@xxxxxxxxxx> |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1439828606-7886-1-git-send-email-jtulak@xxxxxxxxxx> |
| References: | <1439828606-7886-1-git-send-email-jtulak@xxxxxxxxxx> |
Add check for _DIRENT_HAVED_RECLEN/_OFF to read_directory().
In dump_dirent() these checks already are used, but they were
missing in read_directory.
Signed-off-by: Jan Tulak <jtulak@xxxxxxxxxx>
---
io/readdir.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/io/readdir.c b/io/readdir.c
index 7b0edbc..151b72e 100644
--- a/io/readdir.c
+++ b/io/readdir.c
@@ -103,12 +103,24 @@ read_directory(
if (!dirent)
break;
+#ifdef _DIRENT_HAVE_D_RECLEN
*total += dirent->d_reclen;
+#else
+ *total += dirent->d_namlen + sizeof(*dirent);
+#endif
count++;
if (dump) {
dump_dirent(offset, dirent);
+#ifdef _DIRENT_HAVE_D_OFF
offset = dirent->d_off;
+#else
+ /* Some platforms don't have dirent->d_off, but because
+ * it is used only for dumping the value, it should be
+ * safe to only set it to zero in such case.
+ */
+ offset = 0;
+#endif
}
}
--
2.4.5
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 00/11] xfsprogs: Partial OS X support, Jan Tulak |
|---|---|
| Next by Date: | [PATCH 03/11] xfsprogs: Change OS X-specific CFLAGS/LDFLAGS, Jan Tulak |
| Previous by Thread: | [PATCH 00/11] xfsprogs: Partial OS X support, Jan Tulak |
| Next by Thread: | Re: [PATCH 02/11] xfsprogs: Add ifdef dirent checks where it was missing, Christoph Hellwig |
| Indexes: | [Date] [Thread] [Top] [All Lists] |