Btrfs-progs: fix magic return value in cmds-restore.c

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
Wang Shilong 2013-09-04 23:22:28 +08:00 committed by Chris Mason
parent 5894141885
commit d9f612220f
1 changed files with 9 additions and 9 deletions

View File

@ -247,7 +247,7 @@ static int copy_one_inline(int fd, struct btrfs_path *path, u64 pos)
outbuf = malloc(ram_size); outbuf = malloc(ram_size);
if (!outbuf) { if (!outbuf) {
fprintf(stderr, "No memory\n"); fprintf(stderr, "No memory\n");
return -1; return -ENOMEM;
} }
ret = decompress(buf, outbuf, len, &ram_size, compress); ret = decompress(buf, outbuf, len, &ram_size, compress);
@ -308,7 +308,7 @@ static int copy_one_extent(struct btrfs_root *root, int fd,
inbuf = malloc(size_left); inbuf = malloc(size_left);
if (!inbuf) { if (!inbuf) {
fprintf(stderr, "No memory\n"); fprintf(stderr, "No memory\n");
return -1; return -ENOMEM;
} }
if (compress != BTRFS_COMPRESS_NONE) { if (compress != BTRFS_COMPRESS_NONE) {
@ -316,7 +316,7 @@ static int copy_one_extent(struct btrfs_root *root, int fd,
if (!outbuf) { if (!outbuf) {
fprintf(stderr, "No memory\n"); fprintf(stderr, "No memory\n");
free(inbuf); free(inbuf);
return -1; return -ENOMEM;
} }
} }
again: again:
@ -546,7 +546,7 @@ static int copy_file(struct btrfs_root *root, int fd, struct btrfs_key *key,
path = btrfs_alloc_path(); path = btrfs_alloc_path();
if (!path) { if (!path) {
fprintf(stderr, "Ran out of memory\n"); fprintf(stderr, "Ran out of memory\n");
return -1; return -ENOMEM;
} }
path->skip_locking = 1; path->skip_locking = 1;
@ -679,7 +679,7 @@ static int search_dir(struct btrfs_root *root, struct btrfs_key *key,
path = btrfs_alloc_path(); path = btrfs_alloc_path();
if (!path) { if (!path) {
fprintf(stderr, "Ran out of memory\n"); fprintf(stderr, "Ran out of memory\n");
return -1; return -ENOMEM;
} }
path->skip_locking = 1; path->skip_locking = 1;
@ -826,7 +826,7 @@ static int search_dir(struct btrfs_root *root, struct btrfs_key *key,
if (!dir) { if (!dir) {
fprintf(stderr, "Ran out of memory\n"); fprintf(stderr, "Ran out of memory\n");
btrfs_free_path(path); btrfs_free_path(path);
return -1; return -ENOMEM;
} }
if (location.type == BTRFS_ROOT_ITEM_KEY) { if (location.type == BTRFS_ROOT_ITEM_KEY) {
@ -920,7 +920,7 @@ static int do_list_roots(struct btrfs_root *root)
path = btrfs_alloc_path(); path = btrfs_alloc_path();
if (!path) { if (!path) {
fprintf(stderr, "Failed to alloc path\n"); fprintf(stderr, "Failed to alloc path\n");
return -1; return -ENOMEM;
} }
key.offset = 0; key.offset = 0;
@ -1213,7 +1213,7 @@ int cmd_restore(int argc, char **argv)
if ((ret = check_mounted(argv[optind])) < 0) { if ((ret = check_mounted(argv[optind])) < 0) {
fprintf(stderr, "Could not check mount status: %s\n", fprintf(stderr, "Could not check mount status: %s\n",
strerror(-ret)); strerror(-ret));
return ret; return 1;
} else if (ret) { } else if (ret) {
fprintf(stderr, "%s is currently mounted. Aborting.\n", argv[optind]); fprintf(stderr, "%s is currently mounted. Aborting.\n", argv[optind]);
return 1; return 1;
@ -1287,5 +1287,5 @@ out:
if (mreg) if (mreg)
regfree(mreg); regfree(mreg);
close_ctree(root); close_ctree(root);
return ret; return !!ret;
} }