bucoord: restore requires server and partition
authorSimon Wilkinson <sxw@your-file-system.com>
Mon, 4 Mar 2013 16:31:50 +0000 (16:31 +0000)
committerDerrick Brashear <shadow@your-file-system.com>
Tue, 12 Mar 2013 13:51:26 +0000 (06:51 -0700)
The VolRestoreCmd sub command requires that the user specifies
the server and partition - calls which don't do so won't get past
libcmd. Don't check again in the handler that they have been supplied,
as it confuses things.

Caught by coverity (#985953)

Change-Id: Id4548c117b677bd2048744ade8fd91bb15e0e35e
Reviewed-on: http://gerrit.openafs.org/9547
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/bucoord/commands.c

index 48f82e0..ba7eb42 100644 (file)
@@ -1162,21 +1162,17 @@ bc_VolRestoreCmd(struct cmd_syndesc *as, void *arock)
     }
 
     /* specified other destination host */
-    if (as->parms[0].items) {
-       tp = as->parms[0].items->data;
-       if (bc_ParseHost(tp, &destServ)) {
-           afs_com_err(whoami, 0, "Failed to locate destination host '%s'", tp);
-           return -1;
-       }
+    tp = as->parms[0].items->data;
+    if (bc_ParseHost(tp, &destServ)) {
+       afs_com_err(whoami, 0, "Failed to locate destination host '%s'", tp);
+       return -1;
     }
 
     /* specified other destination partition */
-    if (as->parms[1].items) {
-       tp = as->parms[1].items->data;
-       if (bc_GetPartitionID(tp, &destPartition)) {
-           afs_com_err(whoami, 0, "Can't parse destination partition '%s'", tp);
-           return -1;
-       }
+    tp = as->parms[1].items->data;
+    if (bc_GetPartitionID(tp, &destPartition)) {
+       afs_com_err(whoami, 0, "Can't parse destination partition '%s'", tp);
+       return -1;
     }
 
     for (ti = as->parms[2].items; ti; ti = ti->next) {