Fix some posixshmcontrol nits.

- Exit with an error if no path is specified.
- Man page typo.
- Error message typo.

Reviewed by:	kib
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26376
This commit is contained in:
Mark Johnston 2020-09-15 13:36:19 +00:00
parent 1d2a0dce33
commit c6dce83da8
2 changed files with 29 additions and 4 deletions

View File

@ -120,7 +120,7 @@ using name-switch services, instead the raw numeric values are printed.
To show content of the shared memory segment with the path To show content of the shared memory segment with the path
.Pa /1 , .Pa /1 ,
use the command use the command
.Dl "posixshmcontrol dump /q | hexdump -C" .Dl "posixshmcontrol dump /1 | hexdump -C"
.It .It
To create a segment with the path To create a segment with the path
.Pa /2 .Pa /2

View File

@ -147,9 +147,14 @@ create_shm(int argc, char **argv)
return (2); return (2);
} }
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc == 0) {
usage();
return (2);
}
ret = 0; ret = 0;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
ret1 = create_one_shm(argv[i], mode, idx); ret1 = create_one_shm(argv[i], mode, idx);
@ -179,6 +184,11 @@ delete_shm(int argc, char **argv)
{ {
int i, ret, ret1; int i, ret, ret1;
if (argc == 1) {
usage();
return (2);
}
ret = 0; ret = 0;
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
ret1 = delete_one_shm(argv[i]); ret1 = delete_one_shm(argv[i]);
@ -347,6 +357,11 @@ read_shm(int argc, char **argv)
{ {
int i, ret, ret1; int i, ret, ret1;
if (argc == 1) {
usage();
return (2);
}
ret = 0; ret = 0;
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
ret1 = read_one_shm(argv[i]); ret1 = read_one_shm(argv[i]);
@ -433,6 +448,11 @@ stat_shm(int argc, char **argv)
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc == 0) {
usage();
return (2);
}
ret = 0; ret = 0;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
ret1 = stat_one_shm(argv[i], hsize, uname); ret1 = stat_one_shm(argv[i], hsize, uname);
@ -473,16 +493,21 @@ truncate_shm(int argc, char **argv)
switch (c) { switch (c) {
case 's': case 's':
if (expand_number(optarg, &newsize) == -1) if (expand_number(optarg, &newsize) == -1)
err(1, "size:"); err(1, "size");
break; break;
case '?': case '?':
default: default:
return (2); return (2);
} }
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc == 0) {
usage();
return (2);
}
ret = 0; ret = 0;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
ret1 = truncate_one_shm(argv[i], newsize); ret1 = truncate_one_shm(argv[i], newsize);