From 35c97a07aa74dfeb3b96afc093b6b7f3b876e72f Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Wed, 4 Aug 2021 12:06:32 +0200 Subject: [PATCH] vmur/vmur.cpp: Fix error handling on transfer failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The command # vmur punch -r rhcos-live-kernel-s390x -u etpgxku -N kernel.img Reader file with spoolid E YO created and transferred to ETPGXKU. # did not indicate an error when executed. However the file was not transferred and this error message went unnoticed: RPIMGR032E YOU ARE NOT AUTHORIZED TO CLOSE TO TATAC05.ETPGXKU HCPCSL007E Invalid userid - ETPGXKU Fix this by checking the CP return code and print the error message returned by CP. This is the behavior now: # vmur punch -r rhcos-live-kernel-s390x -u etpgxku -N kernel.img vmur: CP command failed with rc=7 RPIMGR032E YOU ARE NOT AUTHORIZED TO CLOSE TO TATAC05.ETPGXKU HCPCSL007E Invalid userid - ETPGXKU # Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/119 Reported-by: Vance Morris Signed-off-by: Thomas Richter Tested-by: Vance Morris Signed-off-by: Jan Höppner --- vmur/vmur.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vmur/vmur.cpp b/vmur/vmur.cpp index 7de6fc4a..5aedd85d 100644 --- a/vmur/vmur.cpp +++ b/vmur/vmur.cpp @@ -1863,7 +1863,6 @@ static void close_ur_device(struct vmur *info) } cpcmd_cs(cmd, &response, &cprc, 0); memcpy(spoolid, &response[9], 4); - free(response); if (cprc == 439) { if (info->action == PUNCH) sprintf(cmd, "PURGE * PUN %s", spoolid); @@ -1872,7 +1871,10 @@ static void close_ur_device(struct vmur *info) cpcmd(cmd, NULL, NULL, 0); ERR_EXIT("User %s spool fileid limit exceeded.\n" , info->user); + } else if (cprc) { + ERR_EXIT("CP command failed with rc=%i\n%s\n", cprc, response); } + free(response); if (info->rdr_specified) { if (info->node_specified) printf("Reader file with spoolid %s created and "