summaryrefslogtreecommitdiff
path: root/restore.c
Commit message (Collapse)AuthorAge
* btrfs-progs: free path before returningZach Brown2013-02-05
| | | | | | | One of the return statements in search_dir() didn't free everything it was supposed to. Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: don't return -EBUSY from main()Zach Brown2013-02-05
| | | | | | | -EBUSY is platform dependent and is even less reliable when truncated to a u8. Just return 1 on error. Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: don't free null pathZach Brown2013-02-05
| | | | | | | btrfs_free_path() derefs the path before freeing it. It can't be passed a null pointer when allocation fails. Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: remove dead code that checks null ebZach Brown2013-02-05
| | | | | | | 'next' can never be non-null in the body of these loops. It's initialized to NULL and the loop is terminated the moment it is set. Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: fix copy-n-paste error checkingZach Brown2013-02-05
| | | | | | | | copy_one_inline() meant to test the return of pwrite() with ram_size. Presumably the comparison with len was copied from the test earlier in the function. Signed-off-by: Zach Brown <zab@redhat.com>
* btrfs-progs: print the right mount checking info in restore.cWang Sheng-Hui2013-01-17
| | | | | | | The mount status is checked against the arg <device> (argv[optind]), not the <directory>. Correct the info printed on <device> mounted. Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
* Btrfs-progs: Fix compiler warnings on PPC64Wade Cline2013-01-17
| | | | | | | | | | | | | | | | The kernel uses unsigned long long for u64, but PPC64 uses unsigned long by default. This results in compilation warnings such as: print-tree.c:333: warning: format '%llu' expects type 'long long unsigned int', but argument 4 has type 'u64' To fix this, the macro __KERNEL__ needs to be defined before including the file <asm/types.h>. This can be done by defining the macro in "kerncompat.h" and making it the first included file in the relevant header files; this fixes the compiler warnings on PPC64. Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Wade Cline <clinew@linux.vnet.ibm.com>
* Btrfs-progs: fix several complie warningMiao Xie2012-10-04
| | | | | | | | | | | | | | This patch fixed the following warning: cmds-send.c:464:6: warning: ‘ret' may be used uninitialized in this function [-Wuninitialized] crc32c.c:121:1: warning: control reaches end of non-void function [-Wreturn-type] send-utils.c:69:11: warning: ‘comp' may be used uninitialized in this function [-Wuninitialized] send-utils.c:126:6: warning: ‘comp' may be used uninitialized in this function [-Wuninitialized] send-utils.c:99:22: warning: ‘entry' may be used uninitialized in this function [-Wuninitialized] btrfs.c:261:2: warning: implicit declaration of function ‘crc32c_optimization_init' [-Wimplicit-function-declaration] btrfs.c:105:2: warning: ‘cmd' may be used uninitialized in this function [-Wuninitialized] restore.c:435:12: warning: ignoring return value of ‘ftruncate', declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
* avoid several strncpy-induced buffer overrunsJim Meyering2012-06-05
| | | | | | | | | | | | | | * restore.c (main): Ensure strncpy-copied dir_name is NUL-terminated. * btrfsctl.c (main): Likewise, for a command-line argument. * utils.c (multiple functions): Likewise. * btrfs-list.c (add_root): Likewise. * btrfslabel.c (change_label_unmounted): Likewise. * cmds-device.c (cmd_add_dev, cmd_rm_dev, cmd_scan_dev): Likewise. * cmds-filesystem.c (cmd_resize): Likewise. * cmds-subvolume.c (cmd_subvol_create, cmd_subvol_delete, cmd_snapshot): Likewise. Reviewed-by: Josef Bacik <josef@redhat.com>
* restore: don't corrupt stack for a zero-length command-line argumentJim Meyering2012-06-05
| | | | | | | | Given a zero-length directory name, the trailing-slash removal code would test dir_name[-1], and if it were found to be a slash, would set it to '\0'. Reviewed-by: Josef Bacik <josef@redhat.com>
* restore: deal with holes and set i_size correctlyChris Mason2011-10-27
| | | | | | | | This changes restore to set the i_size of the files it copies out based on the size in the inode. It also changes it to skip over holes. Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfs-progs: add a recovery utility to pull files from damanged filesystemsJosef Bacik2011-10-27
Signed-off-by: Josef Bacik <josef@redhat.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>