Instead of failing silently when the bosserver is started with an
unknown option, print an error message and exit with a non-zero value.
Continue to exit with 0 when the -help option is given to request the
usage message.
This change should help make bosserver startup failures more obvious
when an unsupported option is specified. Example systemd status message:
systemd[1]: Starting OpenAFS Server Service...
bosserver[32308]: Unrecognized option: -bogus
bosserver[32308]: Usage: bosserver [-noauth] ....
systemd[1]: openafs-server.service: main process exited,
code=exited, status=1/FAILURE
Change-Id: I8717fb4a788fbcc3d1e2d271dd03511c5b504f10
Reviewed-on: https://gerrit.openafs.org/12630
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
else {
/* hack to support help flag */
+ int ec;
+ if (strcmp(argv[code], "-help") == 0 || strcmp(argv[code], "-h") == 0)
+ ec = 0; /* It is not an error to ask for usage. */
+ else {
+ printf("Unrecognized option: %s\n", argv[code]);
+ ec = 1;
+ }
#ifndef AFS_NT40_ENV
printf("Usage: bosserver [-noauth] [-log] "
#endif
fflush(stdout);
- exit(0);
+ exit(ec);
}
}
if (auditFileName) {