mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-22 22:23:32 +00:00
btrfs-progs: send: fix crash on unknown option
The long options array for send is missing the zero terminator, so unknown options result in a crash: # btrfs send --foo Segmentation fault (core dumped) Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
ce7ab16441
commit
8b7d1fc918
@ -496,7 +496,8 @@ static int cmd_send(const struct cmd_struct *cmd, int argc, char **argv)
|
|||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
{ "verbose", no_argument, NULL, 'v' },
|
{ "verbose", no_argument, NULL, 'v' },
|
||||||
{ "quiet", no_argument, NULL, 'q' },
|
{ "quiet", no_argument, NULL, 'q' },
|
||||||
{ "no-data", no_argument, NULL, GETOPT_VAL_SEND_NO_DATA }
|
{ "no-data", no_argument, NULL, GETOPT_VAL_SEND_NO_DATA },
|
||||||
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
int c = getopt_long(argc, argv, "vqec:f:i:p:", long_options, NULL);
|
int c = getopt_long(argc, argv, "vqec:f:i:p:", long_options, NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user