ext4_dir: fix non existing entry creation issue
[lwext4.git] / include / ext4_fs.h
index b598c5e1430ad270c7c5e79ccf7dc638ef566ca6..c52032681816106d874161b07941debfb35c220e 100644 (file)
@@ -46,9 +46,9 @@
 extern "C" {
 #endif
 
-#include "ext4_config.h"
-#include "ext4_types.h"
-#include "ext4_misc.h"
+#include <ext4_config.h>
+#include <ext4_types.h>
+#include <ext4_misc.h>
 
 #include <stdint.h>
 #include <stdbool.h>
@@ -94,7 +94,7 @@ struct ext4_inode_ref {
 static inline uint32_t ext4_fs_addr_to_idx_bg(struct ext4_sblock *s,
                                                     ext4_fsblk_t baddr)
 {
-       if (ext4_get32(s, first_data_block))
+       if (ext4_get32(s, first_data_block) && baddr)
                baddr--;
 
        return baddr % ext4_get32(s, blocks_per_group);