]> git.sur5r.net Git - u-boot/blobdiff - fs/ubifs/ubifs.c
omap3_beagle: Add CONFIG_CMD_ASKENV
[u-boot] / fs / ubifs / ubifs.c
index d16d2b06a7e8b21060a6686d8d3469a5d0a88eed..604eb8fdc213ecf1482222597ebf0663c0776bf7 100644 (file)
@@ -360,6 +360,8 @@ out:
                return err;
        }
 
+       if (file->private_data)
+               kfree(file->private_data);
        if (file)
                free(file);
        if (dentry)
@@ -367,10 +369,6 @@ out:
        if (dir)
                free(dir);
 
-       if (file->private_data)
-               kfree(file->private_data);
-       file->private_data = NULL;
-       file->f_pos = 2;
        return 0;
 }
 
@@ -384,6 +382,7 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
        unsigned long root_inum = 1;
        unsigned long inum;
        int symlink_count = 0; /* Don't allow symlink recursion */
+       char link_name[64];
 
        strcpy(fpath, filename);
 
@@ -420,7 +419,6 @@ static unsigned long ubifs_findfile(struct super_block *sb, char *filename)
                ui = ubifs_inode(inode);
 
                if ((inode->i_mode & S_IFMT) == S_IFLNK) {
-                       char link_name[64];
                        char buf[128];
 
                        /* We have some sort of symlink recursion, bail out */
@@ -688,6 +686,7 @@ int ubifs_load(char *filename, u32 addr, u32 size)
        int i;
        int count;
        int last_block_size = 0;
+       char buf [10];
 
        c->ubi = ubi_open_volume(c->vi.ubi_num, c->vi.vol_id, UBI_READONLY);
        /* ubifs_findfile will resolve symlinks, so we know that we get
@@ -739,8 +738,11 @@ int ubifs_load(char *filename, u32 addr, u32 size)
 
        if (err)
                printf("Error reading file '%s'\n", filename);
-       else
+       else {
+               sprintf(buf, "%X", size);
+               setenv("filesize", buf);
                printf("Done\n");
+       }
 
        ubifs_iput(inode);