From f8efae8c7072593ae519539790838055783affff Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sun, 2 May 2010 14:17:43 -0400 Subject: [PATCH] Windows: normalize return codes from cm_FreelanceAddMount Instead of returning an undefined CM error code, -1, which might end up being confused with an Rx error, return legal CM_ERROR_xxx values. LICENSE MIT Change-Id: Ie78e4e9cf00fa938806c8b355f54169a5691ff04 Reviewed-on: http://gerrit.openafs.org/1889 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_freelance.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/WINNT/afsd/cm_freelance.c b/src/WINNT/afsd/cm_freelance.c index f684496174..4343de5d53 100644 --- a/src/WINNT/afsd/cm_freelance.c +++ b/src/WINNT/afsd/cm_freelance.c @@ -973,6 +973,7 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, DWORD dwType, dwSize; DWORD dwMountPoints; DWORD dwIndex; + afs_uint32 code = 0; /* before adding, verify the cell name; if it is not a valid cell, don't add the mount point. @@ -985,19 +986,21 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, rw ? "rw" : "ro"); if ( filename[0] == '\0' || cellname[0] == '\0' || volume[0] == '\0' ) - return -1; + return CM_ERROR_INVAL; if (cellname[0] == '.') { if (!cm_GetCell_Gen(&cellname[1], fullname, CM_FLAG_CREATE)) - return -1; + return CM_ERROR_INVAL; } else { if (!cm_GetCell_Gen(cellname, fullname, CM_FLAG_CREATE)) - return -1; + return CM_ERROR_INVAL; } if ( cm_FreelanceMountPointExists(filename, 0) || - cm_FreelanceSymlinkExists(filename, 0) ) - return -1; + cm_FreelanceSymlinkExists(filename, 0) ) { + code = CM_ERROR_EXISTS; + goto done; + } osi_Log1(afsd_logp,"Freelance Adding Mount for Cell: %s", osi_LogSaveString(afsd_logp,cellname)); @@ -1081,9 +1084,9 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, cm_noteLocalMountPointChange(TRUE); lock_ReleaseMutex(&cm_Freelance_Lock); + done: if (fidp) { cm_req_t req; - afs_uint32 code; cm_scache_t *scp; clientchar_t *cpath; @@ -1102,7 +1105,7 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw, cm_ReleaseSCache(scp); } - return 0; + return code; } long cm_FreelanceRemoveMount(char *toremove)