- if (ext2fs_inode_has_valid_blocks (&inode))
- ext2fs_block_iterate (fs, ino, BLOCK_FLAG_READ_ONLY, NULL,
+ if (ext2fs_inode_has_valid_blocks (&inode)) {
+ int flags = 0;
+ /* From the docs: "BLOCK_FLAG_READ_ONLY is a promise by the
+ * caller that it will not modify returned block number."
+ * RHEL 5 does not have this flag, so just omit it if it is
+ * not defined.
+ */
+#ifdef BLOCK_FLAG_READ_ONLY
+ flags |= BLOCK_FLAG_READ_ONLY;
+#endif
+ ext2fs_block_iterate (fs, ino, flags, NULL,