From 868ddef206e7c764427cf4abb91e1e69326a2198 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 16 Jul 2009 11:53:52 -0400 Subject: [PATCH] Do not print volume name in DisplayFormat2 if status is not VOK DisplayFormat2 is used to generate volume output for ListVolumes and ExamineVolume. If the volume status is not VOK, the name field will not have been populated with valid data. Do not print it. This commit also removes an extraneous switch block from XDisplayFormat2. The switch variable is already known to have the value VOK due to an enclosing conditional. FIXES 125111 LICENSE MIT Reviewed-on: http://gerrit.openafs.org/140 Reviewed-by: Derrick Brashear Verified-by: Derrick Brashear --- src/volser/vos.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/volser/vos.c b/src/volser/vos.c index df766d411..f79ae7c2a 100644 --- a/src/volser/vos.c +++ b/src/volser/vos.c @@ -882,17 +882,7 @@ XDisplayFormat2(volintXInfo *a_xInfoP, afs_int32 a_servID, afs_int32 a_partID, fprintf(STDOUT, "id\t\t%lu\n", afs_printable_uint32_lu(a_xInfoP->volid)); fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname); fprintf(STDOUT, "part\t\t%s\n", pname); - switch (a_xInfoP->status) { - case VOK: - fprintf(STDOUT, "status\t\tOK\n"); - break; - case VBUSY: - fprintf(STDOUT, "status\t\tBUSY\n"); - return; - default: - fprintf(STDOUT, "status\t\tUNATTACHABLE\n"); - return; - } + fprintf(STDOUT, "status\t\tOK\n"); fprintf(STDOUT, "backupID\t%lu\n", afs_printable_uint32_lu(a_xInfoP->backupID)); fprintf(STDOUT, "parentID\t%lu\n", @@ -1031,7 +1021,10 @@ DisplayFormat2(long server, long partition, volintInfo *pntr) MapPartIdIntoName(partition, pname); partition_cache = partition; } - fprintf(STDOUT, "name\t\t%s\n", pntr->name); + + if (pntr->status == VOK) + fprintf(STDOUT, "name\t\t%s\n", pntr->name); + fprintf(STDOUT, "id\t\t%lu\n", afs_printable_uint32_lu(pntr->volid)); fprintf(STDOUT, "serv\t\t%s\t%s\n", address, hostname); -- 2.39.5