Whamcloud - gitweb
build: fix build warnings for MacOS
[tools/e2fsprogs.git] / lib / ext2fs / newdir.c
index 4e7b40d..b0a1e47 100644 (file)
@@ -4,11 +4,12 @@
  * Copyright (C) 1994, 1995 Theodore Ts'o.
  *
  * %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
  * %End-Header%
  */
 
+#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #if HAVE_UNISTD_H
@@ -41,7 +42,10 @@ errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
                return retval;
        memset(buf, 0, fs->blocksize);
        dir = (struct ext2_dir_entry *) buf;
-       dir->rec_len = fs->blocksize;
+
+       retval = ext2fs_set_rec_len(fs, fs->blocksize, dir);
+       if (retval)
+               return retval;
 
        if (dir_ino) {
                if (fs->super->s_feature_incompat &
@@ -60,7 +64,9 @@ errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
                 * Set up entry for '..'
                 */
                dir = (struct ext2_dir_entry *) (buf + dir->rec_len);
-               dir->rec_len = rec_len;
+               retval = ext2fs_set_rec_len(fs, rec_len, dir);
+               if (retval)
+                       return retval;
                dir->inode = parent_ino;
                dir->name_len = 2 | filetype;
                dir->name[0] = '.';