diff options
author | srivijitha dugganapalli <Srivijitha.Dugganapalli@Sun.COM> | 2010-02-18 12:37:30 -0700 |
---|---|---|
committer | srivijitha dugganapalli <Srivijitha.Dugganapalli@Sun.COM> | 2010-02-18 12:37:30 -0700 |
commit | 7b506e25917c371db526f76d85b9b1d17c8c5d39 (patch) | |
tree | 6d4d6a0b5b20187d26ecf83f5ca5d508cd316de8 /usr/src/cmd/stmfadm | |
parent | 20272c2e66d77f79ef35e7160584b5d098c3287f (diff) | |
download | illumos-gate-7b506e25917c371db526f76d85b9b1d17c8c5d39.tar.gz |
6896927 stmfGetViewEntryList() should return an empty list when no views are found
6901489 stmfadm delete-lu 600144F0D8EBC60000004B0009D002EA -k return 0, it should return non-zero
6908989 delete_lu() should check for length of the GUID passed in
6908988 deleteLuFunc() should check for length of the GUID passed in
6899423 addTargetGroupMemberFunc, addHostGroupMemberFunc don't count perm error
6901477 stmfSet(Get)LuProp with 65535 as prop return STMF_ERROR_NO_PROP insteat of STMF_ERROR_INVALID_PROP
6904251 stmfGetLuResource core dumped when invoked with NULL as hdl
6864263 The max length of LU alias is less than 255 chars
Diffstat (limited to 'usr/src/cmd/stmfadm')
-rw-r--r-- | usr/src/cmd/stmfadm/stmfadm.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/usr/src/cmd/stmfadm/stmfadm.c b/usr/src/cmd/stmfadm/stmfadm.c index 045edfb50b..518ecac4b2 100644 --- a/usr/src/cmd/stmfadm/stmfadm.c +++ b/usr/src/cmd/stmfadm/stmfadm.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -303,6 +303,7 @@ addHostGroupMemberFunc(int operandLen, char *operands[], cmdOptions_t *options, case STMF_ERROR_PERM: (void) fprintf(stderr, "%s: %s\n", cmdName, gettext("permission denied")); + ret++; break; case STMF_ERROR_BUSY: (void) fprintf(stderr, "%s: %s: %s\n", cmdName, @@ -390,6 +391,7 @@ addTargetGroupMemberFunc(int operandLen, char *operands[], case STMF_ERROR_PERM: (void) fprintf(stderr, "%s: %s\n", cmdName, gettext("permission denied")); + ret++; break; case STMF_ERROR_BUSY: (void) fprintf(stderr, "%s: %s: %s\n", cmdName, @@ -1323,6 +1325,7 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options, boolean_t viewEntriesRemoved = B_FALSE; boolean_t noLunFound = B_FALSE; boolean_t views = B_FALSE; + boolean_t notValidHexNumber = B_FALSE; char sGuid[GUID_INPUT + 1]; stmfViewEntryList *viewEntryList = NULL; @@ -1344,15 +1347,19 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options, for (i = 0; i < operandLen; i++) { for (j = 0; j < GUID_INPUT; j++) { if (!isxdigit(operands[i][j])) { + notValidHexNumber = B_TRUE; break; } sGuid[j] = tolower(operands[i][j]); } - if (j != GUID_INPUT) { + if ((notValidHexNumber == B_TRUE) || + (strlen(operands[i]) != GUID_INPUT)) { (void) fprintf(stderr, "%s: %s: %s%d%s\n", cmdName, operands[i], gettext("must be "), GUID_INPUT, gettext(" hexadecimal digits long")); + notValidHexNumber = B_FALSE; + ret++; continue; } @@ -1401,13 +1408,16 @@ deleteLuFunc(int operandLen, char *operands[], cmdOptions_t *options, (void) stmfRemoveViewEntry(&delGuid, viewEntryList->ve[j].veIndex); } - viewEntriesRemoved = B_TRUE; + /* check if viewEntryList is empty */ + if (viewEntryList->cnt != 0) + viewEntriesRemoved = B_TRUE; stmfFreeMemory(viewEntryList); - } else if (stmfRet != STMF_ERROR_NOT_FOUND) { + } else { (void) fprintf(stderr, "%s: %s\n", cmdName, gettext("unable to remove view entries\n")); ret++; - } /* No view entries to remove */ + } + } if (keepViews) { stmfRet = stmfGetViewEntryList(&delGuid, @@ -2004,9 +2014,6 @@ listLuFunc(int operandLen, char *operands[], cmdOptions_t *options, void *args) if (stmfRet == STMF_STATUS_SUCCESS) { (void) printf("%d", viewEntryList->cnt); - } else if (stmfRet == - STMF_ERROR_NOT_FOUND) { - (void) printf("0"); } else { (void) printf("unknown"); } @@ -2722,10 +2729,6 @@ listViewFunc(int operandLen, char *operands[], cmdOptions_t *options, (void) fprintf(stderr, "%s: %s: %s\n", cmdName, sGuid, gettext("resource busy")); break; - case STMF_ERROR_NOT_FOUND: - (void) fprintf(stderr, "%s: %s: %s\n", cmdName, - sGuid, gettext("no views found")); - break; case STMF_ERROR_SERVICE_NOT_FOUND: (void) fprintf(stderr, "%s: %s\n", cmdName, gettext("STMF service not found")); @@ -2746,6 +2749,12 @@ listViewFunc(int operandLen, char *operands[], cmdOptions_t *options, return (1); } + if (viewEntryList->cnt == 0) { + (void) fprintf(stderr, "%s: %s: %s\n", cmdName, + sGuid, gettext("no views found")); + return (1); + } + for (i = 0; i < outerLoop; i++) { for (found = B_FALSE, j = 0; j < viewEntryList->cnt; j++) { if (operandEntered) { @@ -3263,10 +3272,6 @@ removeViewFunc(int operandLen, char *operands[], cmdOptions_t *options, (void) fprintf(stderr, "%s: %s: %s\n", cmdName, sGuid, gettext("resource busy")); break; - case STMF_ERROR_NOT_FOUND: - (void) fprintf(stderr, "%s: %s: %s\n", cmdName, - sGuid, gettext("no views found")); - break; case STMF_ERROR_SERVICE_NOT_FOUND: (void) fprintf(stderr, "%s: %s\n", cmdName, gettext("STMF service not found")); @@ -3287,6 +3292,12 @@ removeViewFunc(int operandLen, char *operands[], cmdOptions_t *options, return (1); } + if (viewEntryList->cnt == 0) { + (void) fprintf(stderr, "%s: %s: %s\n", cmdName, + sGuid, gettext("no views found")); + return (1); + } + if (all) { count = viewEntryList->cnt; } else { |