1.1 --- a/libe2access/lib/src/image.c Wed Mar 02 23:53:42 2022 +0100
1.2 +++ b/libe2access/lib/src/image.c Thu Mar 03 22:42:55 2022 +0100
1.3 @@ -225,14 +225,14 @@
1.4 }
1.5 }
1.6
1.7 -/* Find an object with the given path in the filesystem image. */
1.8 +/* Find an object with the given path. */
1.9
1.10 errcode_t image_find_by_path(ext2_filsys fs, const char *path, ext2_ino_t *ino)
1.11 {
1.12 return image_resolve_by_path(fs, &path, ino);
1.13 }
1.14
1.15 -/* Find an object with the given path in the filesystem image. */
1.16 +/* Find an object with the given path. */
1.17
1.18 errcode_t image_resolve_by_path(ext2_filsys fs, const char **path,
1.19 ext2_ino_t *ino)
1.20 @@ -241,7 +241,12 @@
1.21 ext2_ino_t ino_dir;
1.22 errcode_t retval;
1.23
1.24 + /* Initialise the inode in case of early failure. */
1.25 +
1.26 + *ino = 0;
1.27 +
1.28 retval = ext2fs_get_mem(fs->blocksize, &buf);
1.29 +
1.30 if (retval)
1.31 return retval;
1.32
1.33 @@ -278,8 +283,8 @@
1.34 return retval;
1.35 }
1.36
1.37 -/* Find an object in the given directory with the given name in the filesystem
1.38 - image, updating the name reference to refer to the next component. */
1.39 +/* Find an object in the given directory with the given name, updating the name
1.40 + reference to refer to the next component. */
1.41
1.42 errcode_t image_resolve_next(ext2_filsys fs, ext2_ino_t ino_dir,
1.43 const char **basename, char *buf, ext2_ino_t *ino)
1.44 @@ -299,8 +304,7 @@
1.45 return retval;
1.46 }
1.47
1.48 -/* Find an object in the given directory with the given name in the filesystem
1.49 - image. */
1.50 +/* Find an object in the given directory with the given name. */
1.51
1.52 errcode_t image_find_file(ext2_filsys fs, const char *dirname,
1.53 const char *basename, ext2_ino_t *ino)
1.54 @@ -314,8 +318,7 @@
1.55 return image_find_by_path(fs, path, ino);
1.56 }
1.57
1.58 -/* Obtain the inode for the object with the given path in the filesystem
1.59 - image. */
1.60 +/* Obtain the inode for the object with the given path. */
1.61
1.62 errcode_t image_inode(ext2_filsys fs, const char *path,
1.63 struct ext2_inode *inode)
1.64 @@ -353,7 +356,7 @@
1.65 return ext2fs_write_inode(fs, ino, &inode);
1.66 }
1.67
1.68 -/* List a directory in the filesystem image. */
1.69 +/* List a directory. */
1.70
1.71 errcode_t image_list_dir(ext2_filsys fs, const char *path,
1.72 int (*proc)(struct ext2_dir_entry *, int, int, char *,
1.73 @@ -395,8 +398,8 @@
1.74 return 0;
1.75 }
1.76
1.77 -/* Make a directory in the given directory in the filesystem image having the
1.78 - given name and metadata. */
1.79 +/* Make a directory in the given directory having the given name and
1.80 + metadata. */
1.81
1.82 errcode_t image_make_dir(ext2_filsys fs, ext2_ino_t ino_dir,
1.83 const char *basename, __u16 mode,
1.84 @@ -426,8 +429,8 @@
1.85 return ext2fs_write_inode(fs, *ino, &inode_dir);
1.86 }
1.87
1.88 -/* Make a directory in the given directory in the filesystem image, updating
1.89 - the name reference to refer to the next component. */
1.90 +/* Make a directory in the given directory, updating the name reference to refer
1.91 + to the next component. */
1.92
1.93 errcode_t image_make_next_dir(ext2_filsys fs, ext2_ino_t ino_dir,
1.94 const char **basename, __u16 mode, __u16 uid,
1.95 @@ -458,7 +461,7 @@
1.96 return retval;
1.97 }
1.98
1.99 -/* Make directories descending to the given path in the filesystem image. */
1.100 +/* Make directories descending to the given path. */
1.101
1.102 errcode_t image_make_dirs(ext2_filsys fs, const char **path,
1.103 ext2_ino_t ino_dir, __u16 mode, __u16 uid, __u16 gid)
1.104 @@ -713,7 +716,7 @@
1.105
1.106
1.107
1.108 -/* Test object presence and types in the filesystem image. */
1.109 +/* Test object presence and types. */
1.110
1.111 int image_exists(ext2_filsys fs, const char *path)
1.112 {