vos: complain if no fields are passed

to vos "setfields". It might be a misleading if it exists
sucessfully when clearly invoked wrongly.

Change-Id: Ic92f4e17fde0a0dfc182f9713350800c72fa165e
Reviewed-on: http://gerrit.openafs.org/10271
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
This commit is contained in:
Christof Hanke 2013-09-24 11:01:08 +02:00 committed by Derrick Brashear
parent 8fc86de33e
commit 1a42219e63

View File

@ -1714,6 +1714,7 @@ SetFields(struct cmd_syndesc *as, void *arock)
afs_uint32 aserver;
afs_int32 apart;
int previdx = -1;
int have_field = 0;
volid = vsu_GetVolumeID(as->parms[0].items->data, cstruct, &err); /* -id */
if (volid == 0) {
@ -1747,6 +1748,7 @@ SetFields(struct cmd_syndesc *as, void *arock)
if (as->parms[1].items) {
/* -max <quota> */
have_field = 1;
code = util_GetHumanInt32(as->parms[1].items->data, &info.maxquota);
if (code) {
fprintf(STDERR, "invalid quota value\n");
@ -1755,12 +1757,18 @@ SetFields(struct cmd_syndesc *as, void *arock)
}
if (as->parms[2].items) {
/* -clearuse */
have_field = 1;
info.dayUse = 0;
}
if (as->parms[3].items) {
/* -clearVolUpCounter */
have_field = 1;
info.spare2 = 0;
}
if (!have_field) {
fprintf(STDERR,"Nothing to set.\n");
return (1);
}
code = UV_SetVolumeInfo(aserver, apart, volid, &info);
if (code)
fprintf(STDERR,