mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Fix clvmd return code for bad options.
We should return exit code 2 for unknown option. Patch also adds standard --help option instead. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=666991
This commit is contained in:
parent
5446fc8cea
commit
5a47eb762a
@ -1,5 +1,6 @@
|
||||
Version 2.02.85 -
|
||||
===================================
|
||||
Support --help option for clvmd and return error for unknown option.
|
||||
Use system page size and not hardcoded value in locking code check.
|
||||
Fix reading of released memory for printing segment type.
|
||||
Fix syslog initialisation in clvmd to respect lvm.conf setting.
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "clvmd-common.h"
|
||||
|
||||
#include <pthread.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "clvmd-comms.h"
|
||||
#include "clvm.h"
|
||||
@ -335,7 +336,7 @@ int main(int argc, char *argv[])
|
||||
struct local_client *newfd;
|
||||
struct utsname nodeinfo;
|
||||
struct lvm_startup_params lvm_params;
|
||||
signed char opt;
|
||||
int opt;
|
||||
int cmd_timeout = DEFAULT_CMD_TIMEOUT;
|
||||
int start_timeout = 0;
|
||||
if_type_t cluster_iface = IF_AUTO;
|
||||
@ -346,19 +347,21 @@ int main(int argc, char *argv[])
|
||||
int clusterwide_opt = 0;
|
||||
mode_t old_mask;
|
||||
|
||||
struct option longopts[] = {
|
||||
{ "help", 0, 0, 'h' },
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
|
||||
/* Deal with command-line arguments */
|
||||
opterr = 0;
|
||||
optind = 0;
|
||||
while ((opt = getopt(argc, argv, "?vVhfd::t:RST:CI:E:")) != EOF) {
|
||||
while ((opt = getopt_long(argc, argv, "vVhfd::t:RST:CI:E:",
|
||||
longopts, NULL)) != -1) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage(argv[0], stdout);
|
||||
exit(0);
|
||||
|
||||
case '?':
|
||||
usage(argv[0], stderr);
|
||||
exit(0);
|
||||
|
||||
case 'R':
|
||||
check_permissions();
|
||||
return refresh_clvmd(1)==1?0:1;
|
||||
@ -409,6 +412,9 @@ int main(int argc, char *argv[])
|
||||
exit(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
usage(argv[0], stderr);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user