btrfsprogs/0106-Fix-sub-snap-parameter-handling.patch
David Sterba db07609875 - btrfs-progs-fix-open_ctree_usage_segfaults.patch: fix
segfaults from bnc#710486 due to unchecked usage of return
  value of open_ctree()
  [fixed compilation warnings]

- pull upstream, replace existing patches, spec update
- update 'restore' utility
  - lzo support
  - tools may now take earlies superblock when opening the fs
  - other fixes
- pull integration-20111030 branch
  - mkfs: force mkfs if desired
  - other fixes
- add btrfs-dump-super to mkinitrd
- other fixes
  - skip non-existent devices or without media
  - documentation updates
  - scrubbing single device
  - graceful error handling when opening fs fails

- updated mkinitrd script to scan devices before mount (bnc#727383)

OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=115
2011-12-14 23:25:51 +00:00

85 lines
2.0 KiB
Diff

From 33be6f1695e8bd450be2e22fbf88b826488186a1 Mon Sep 17 00:00:00 2001
From: Hugo Mills <hugo@carfax.org.uk>
Date: Sun, 30 Oct 2011 20:17:07 +0000
Subject: [PATCH 07/35] Fix sub snap parameter handling
btrfs sub snap uses a local copy of optind, which causes the number of
parameters to be miscounted, preventing it from working properly. This
patch, originally from Arne Jansen <sensille@gmx.net>, fixes it.
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
---
btrfs_cmds.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/btrfs_cmds.c b/btrfs_cmds.c
index b59e9cb..9252ffa 100644
--- a/btrfs_cmds.c
+++ b/btrfs_cmds.c
@@ -304,7 +304,8 @@ int do_subvol_list(int argc, char **argv)
int ret;
int print_parent = 0;
char *subvol;
- int optind = 1;
+
+ optind = 1;
while(1) {
int c = getopt(argc, argv, "p");
@@ -312,7 +313,6 @@ int do_subvol_list(int argc, char **argv)
switch(c) {
case 'p':
print_parent = 1;
- optind++;
break;
}
}
@@ -347,11 +347,13 @@ int do_subvol_list(int argc, char **argv)
int do_clone(int argc, char **argv)
{
- char *subvol, *dst;
- int res, fd, fddst, len, e, optind = 0, readonly = 0;
- char *newname;
- char *dstdir;
- struct btrfs_ioctl_vol_args_v2 args;
+ char *subvol, *dst;
+ int res, fd, fddst, len, e, readonly = 0;
+ char *newname;
+ char *dstdir;
+ struct btrfs_ioctl_vol_args_v2 args;
+
+ optind = 1;
memset(&args, 0, sizeof(args));
@@ -362,7 +364,6 @@ int do_clone(int argc, char **argv)
break;
switch (c) {
case 'r':
- optind++;
readonly = 1;
break;
default:
@@ -372,14 +373,14 @@ int do_clone(int argc, char **argv)
return 1;
}
}
- if (argc - optind != 3) {
+ if (argc - optind != 2) {
fprintf(stderr, "Invalid arguments for subvolume snapshot\n");
free(argv);
return 1;
}
- subvol = argv[optind+1];
- dst = argv[optind+2];
+ subvol = argv[optind];
+ dst = argv[optind+1];
res = test_issubvolume(subvol);
if(res<0){
--
1.7.6.233.gd79bc