{
struct btrfs_root *root;
int ret;
- int num = 0;
+ u64 num = 0;
u64 bytenr = 0;
while(1) {
break;
switch(c) {
case 's':
- num = atol(optarg);
- bytenr = btrfs_sb_offset(num);
+ num = arg_strtou64(optarg);
+ if (num >= BTRFS_SUPER_MIRROR_MAX) {
+ fprintf(stderr,
+ "ERROR: super mirror should be less than: %d\n",
+ BTRFS_SUPER_MIRROR_MAX);
+ exit(1);
+ }
+ bytenr = btrfs_sb_offset(((int)num));
break;
default:
print_usage();
}
}
+ set_argv0(av);
ac = ac - optind;
- if (ac != 1)
+ if (check_argc_exact(ac, 1))
print_usage();
if (bytenr == 0) {
/* we don't close the ctree or anything, because we don't want a real
* transaction commit. We just want the super copy we pulled off the
* disk to overwrite all the other copies
- */
- printf("using SB copy %d, bytenr %llu\n", num,
+ */
+ printf("using SB copy %llu, bytenr %llu\n", (unsigned long long)num,
(unsigned long long)bytenr);
return ret;
}