summaryrefslogtreecommitdiff
path: root/e2fsprogs/ext2fs/get_pathname.c
diff options
context:
space:
mode:
Diffstat (limited to 'e2fsprogs/ext2fs/get_pathname.c')
-rw-r--r--e2fsprogs/ext2fs/get_pathname.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/e2fsprogs/ext2fs/get_pathname.c b/e2fsprogs/ext2fs/get_pathname.c
index 23f593f..594090d 100644
--- a/e2fsprogs/ext2fs/get_pathname.c
+++ b/e2fsprogs/ext2fs/get_pathname.c
@@ -1,6 +1,6 @@
/*
* get_pathname.c --- do directry/inode -> name translation
- *
+ *
* Copyright (C) 1993, 1994, 1995 Theodore Ts'o.
*
* %Begin-Header%
@@ -8,14 +8,14 @@
* License.
* %End-Header%
*
- * ext2fs_get_pathname(fs, dir, ino, name)
+ * ext2fs_get_pathname(fs, dir, ino, name)
+ *
+ * This function translates takes two inode numbers into a
+ * string, placing the result in <name>. <dir> is the containing
+ * directory inode, and <ino> is the inode number itself. If
+ * <ino> is zero, then ext2fs_get_pathname will return pathname
+ * of the the directory <dir>.
*
- * This function translates takes two inode numbers into a
- * string, placing the result in <name>. <dir> is the containing
- * directory inode, and <ino> is the inode number itself. If
- * <ino> is zero, then ext2fs_get_pathname will return pathname
- * of the the directory <dir>.
- *
*/
#include <stdio.h>
@@ -65,8 +65,8 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent,
return 0;
}
-static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
- ext2_ino_t ino, int maxdepth,
+static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
+ ext2_ino_t ino, int maxdepth,
char *buf, char **name)
{
struct get_pathname_struct gp;
@@ -93,7 +93,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
gp.parent = 0;
gp.name = 0;
gp.errcode = 0;
-
+
retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp);
if (retval)
goto cleanup;
@@ -110,15 +110,15 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
*name = parent_name;
return 0;
}
-
- if (gp.name)
+
+ if (gp.name)
retval = ext2fs_get_mem(strlen(parent_name)+strlen(gp.name)+2,
&ret);
else
retval = ext2fs_get_mem(strlen(parent_name)+5, &ret);
if (retval)
goto cleanup;
-
+
ret[0] = 0;
if (parent_name[1])
strcat(ret, parent_name);
@@ -130,7 +130,7 @@ static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir,
*name = ret;
ext2fs_free_mem(&parent_name);
retval = 0;
-
+
cleanup:
if (gp.name)
ext2fs_free_mem(&gp.name);
@@ -153,5 +153,5 @@ errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
retval = ext2fs_get_pathname_int(fs, dir, ino, 32, buf, name);
ext2fs_free_mem(&buf);
return retval;
-
+
}