btrfs-progs/check
Qu Wenruo f61b90aff9 btrfs-progs: make usage call properly return an exit value
[BUG]
Currently cli/009 test case failed with different exit number:

  ====== RUN CHECK /home/adam/btrfs-progs/btrfstune --help
  usage: btrfstune [options] device
  [...]
  failed: /home/adam/btrfs-progs/btrfstune --help
  test failed for case 009-btrfstune

[CAUSE]
In tune/main.c, we have the following call on usage():

  static void print_usage(int ret)
  {
	usage(&tune_cmd);
	exit(ret);
  }

However usage() itself would always call exit(1):

  void usage(const struct cmd_struct *cmd)
  {
	usage_command_usagestr(cmd->usagestr, NULL, 0, true, true);
	exit(1);
  }

This makes prevents any caller of usage() to modify its exit number.

[FIX]
Add a new argument @error for print_usage(), so we can properly return 0
for -h/--help usage.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-02-28 20:11:23 +01:00
..
clear-cache.c btrfs-progs: use template for transaction start error messages 2022-10-11 09:08:10 +02:00
clear-cache.h btrfs-progs: check: factor out code for clearing caches 2022-10-11 09:08:09 +02:00
common.h btrfs-progs: check: move global variables to common headers 2022-10-11 09:08:09 +02:00
main.c btrfs-progs: make usage call properly return an exit value 2023-02-28 20:11:23 +01:00
mode-common.c btrfs-progs: sync compression.h from the kernel 2022-11-30 19:14:29 +01:00
mode-common.h btrfs-progs: check: move global variables to common headers 2022-10-11 09:08:09 +02:00
mode-lowmem.c btrfs-progs: sync compression.h from the kernel 2022-11-30 19:14:29 +01:00
mode-lowmem.h btrfs-progs: check: update include lists 2022-10-11 09:06:12 +02:00
mode-original.h btrfs-progs: check: add check for overlong xattr names 2022-04-25 18:52:49 +02:00
qgroup-verify.c Revert "btrfs-progs: rename qgroup items to match the kernel naming scheme" 2023-01-03 13:10:54 +01:00
qgroup-verify.h btrfs-progs: check: update include lists 2022-10-11 09:06:12 +02:00
repair.c btrfs-progs: check: rename global repair option 2022-10-11 09:08:09 +02:00
repair.h btrfs-progs: check: rename global repair option 2022-10-11 09:08:09 +02:00