btrfs-progs/common
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
..
box.h btrfs-progs: build most common tools into one binary (busybox style) 2019-07-04 15:30:40 +02:00
cpu-utils.c btrfs-progs: add special CPU flag bit representing no features 2023-02-28 19:49:31 +01:00
cpu-utils.h btrfs-progs: add special CPU flag bit representing no features 2023-02-28 19:49:31 +01:00
defs.h btrfs-progs: move common-defs to common/ 2020-03-31 18:37:35 +02:00
device-scan.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
device-scan.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
device-utils.c btrfs-progs: device-utils: rename btrfs_device_size 2022-10-11 09:08:10 +02:00
device-utils.h btrfs-progs: device-utils: rename btrfs_device_size 2022-10-11 09:08:10 +02:00
extent-cache.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
extent-cache.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
filesystem-utils.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
filesystem-utils.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
format-output.c btrfs-progs: fix fallthrough cases with proper attributes 2023-02-18 17:44:02 +01:00
format-output.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
fsfeatures.c btrfs-progs: mkfs: fix compat version of block-group-tree 2022-10-17 15:46:37 +02:00
fsfeatures.h btrfs-progs: mkfs: fix a stack over-flow when features string are too long 2022-10-11 09:08:12 +02:00
help.c btrfs-progs: make usage call properly return an exit value 2023-02-28 20:11:23 +01:00
help.h btrfs-progs: make usage call properly return an exit value 2023-02-28 20:11:23 +01:00
internal.h btrfs-progs: move internal.h to common/ 2019-07-03 20:49:03 +02:00
messages.c btrfs-progs: add helper to print messages to stderr 2022-10-11 09:08:11 +02:00
messages.h btrfs-progs: add helper to print messages to stderr 2022-10-11 09:08:11 +02:00
open-utils.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
open-utils.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
parse-utils.c btrfs-progs: fix fallthrough cases with proper attributes 2023-02-18 17:44:02 +01:00
parse-utils.h btrfs-progs: move parse_qgroupid_or_path to parse-utils 2022-10-11 09:06:13 +02:00
path-utils.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
path-utils.h btrfs-progs: remove unnecessary linux/*.h includes 2021-05-06 16:41:47 +02:00
rbtree-utils.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
rbtree-utils.h btrfs-progs: remove c++ protection from internal headers 2021-10-08 20:47:04 +02:00
send-stream.c btrfs-progs: receive: fix parsing of attributes field from the fileattr command 2022-11-24 17:29:11 +01:00
send-stream.h btrfs-progs: receive: add support for fs-verity 2022-10-11 09:08:08 +02:00
send-utils.c btrfs-progs: use error helper for messages in non-kernel code 2022-10-11 09:08:07 +02:00
send-utils.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
string-table.c btrfs-progs: string-table: add ranged API for printing and clearing 2022-12-05 20:32:02 +01:00
string-table.h btrfs-progs: string-table: add ranged API for printing and clearing 2022-12-05 20:32:02 +01:00
string-utils.c btrfs-progs: use error helper for messages in non-kernel code 2022-10-11 09:08:07 +02:00
string-utils.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
task-utils.c btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
task-utils.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
units.c btrfs-progs: fix fallthrough cases with proper attributes 2023-02-18 17:44:02 +01:00
units.h btrfs-progs: common: update include lists, part 1 2022-10-11 09:08:07 +02:00
utils.c btrfs-progs: add warning helper for experimental build 2022-10-20 16:29:13 +02:00
utils.h btrfs-progs: ioctl: move btrfs_err_str into common/utils.h 2022-11-28 18:57:43 +01:00