mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 07:20:11 +00:00
Windows: normalize error codes from cm_FreelanceAddSymlink
Return all error codes from the end of the function. LICENSE MIT Change-Id: I7703c90884820ed7eb1f43183d80c7df038cfb8b Reviewed-on: http://gerrit.openafs.org/1891 Reviewed-by: Jeffrey Altman <jaltman@openafs.org> Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
parent
da2db62342
commit
ec35612ce9
@ -1230,8 +1230,10 @@ long cm_FreelanceAddSymlink(char *filename, char *destination, cm_fid_t *fidp)
|
|||||||
DWORD dwType, dwSize;
|
DWORD dwType, dwSize;
|
||||||
DWORD dwSymlinks;
|
DWORD dwSymlinks;
|
||||||
DWORD dwIndex;
|
DWORD dwIndex;
|
||||||
|
afs_uint32 code = 0;
|
||||||
|
|
||||||
/* before adding, verify the filename. If it is already in use, either as
|
/*
|
||||||
|
* before adding, verify the filename. If it is already in use, either as
|
||||||
* as mount point or a cellname, do not permit the creation of the symlink.
|
* as mount point or a cellname, do not permit the creation of the symlink.
|
||||||
*/
|
*/
|
||||||
osi_Log2(afsd_logp,"Freelance Add Symlink request: filename=%s destination=%s",
|
osi_Log2(afsd_logp,"Freelance Add Symlink request: filename=%s destination=%s",
|
||||||
@ -1244,17 +1246,23 @@ long cm_FreelanceAddSymlink(char *filename, char *destination, cm_fid_t *fidp)
|
|||||||
fullname[0] = '\0';
|
fullname[0] = '\0';
|
||||||
if (filename[0] == '.') {
|
if (filename[0] == '.') {
|
||||||
cm_GetCell_Gen(&filename[1], fullname, CM_FLAG_CREATE);
|
cm_GetCell_Gen(&filename[1], fullname, CM_FLAG_CREATE);
|
||||||
if (cm_stricmp_utf8(&filename[1],fullname) == 0)
|
if (cm_stricmp_utf8(&filename[1],fullname) == 0) {
|
||||||
return CM_ERROR_EXISTS;
|
code = CM_ERROR_EXISTS;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cm_GetCell_Gen(filename, fullname, CM_FLAG_CREATE);
|
cm_GetCell_Gen(filename, fullname, CM_FLAG_CREATE);
|
||||||
if (cm_stricmp_utf8(filename,fullname) == 0)
|
if (cm_stricmp_utf8(filename,fullname) == 0) {
|
||||||
return CM_ERROR_EXISTS;
|
code = CM_ERROR_EXISTS;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( cm_FreelanceMountPointExists(filename, 0) ||
|
if ( cm_FreelanceMountPointExists(filename, 0) ||
|
||||||
cm_FreelanceSymlinkExists(filename, 0) )
|
cm_FreelanceSymlinkExists(filename, 0) ) {
|
||||||
return CM_ERROR_EXISTS;
|
code = CM_ERROR_EXISTS;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
lock_ObtainMutex(&cm_Freelance_Lock);
|
lock_ObtainMutex(&cm_Freelance_Lock);
|
||||||
|
|
||||||
@ -1317,34 +1325,35 @@ long cm_FreelanceAddSymlink(char *filename, char *destination, cm_fid_t *fidp)
|
|||||||
cm_noteLocalMountPointChange(TRUE);
|
cm_noteLocalMountPointChange(TRUE);
|
||||||
lock_ReleaseMutex(&cm_Freelance_Lock);
|
lock_ReleaseMutex(&cm_Freelance_Lock);
|
||||||
|
|
||||||
|
done:
|
||||||
if (fidp) {
|
if (fidp) {
|
||||||
cm_req_t req;
|
cm_req_t req;
|
||||||
afs_uint32 code;
|
|
||||||
cm_scache_t *scp;
|
cm_scache_t *scp;
|
||||||
clientchar_t *cpath;
|
clientchar_t *cpath;
|
||||||
|
|
||||||
cm_InitReq(&req);
|
cm_InitReq(&req);
|
||||||
|
|
||||||
cpath = cm_FsStringToClientStringAlloc(filename, -1, NULL);
|
cpath = cm_FsStringToClientStringAlloc(filename, -1, NULL);
|
||||||
if (!cpath)
|
if (!cpath) {
|
||||||
return CM_ERROR_NOSUCHPATH;
|
code = CM_ERROR_NOSUCHPATH;
|
||||||
|
} else {
|
||||||
|
if (cm_getLocalMountPointChange()) { // check for changes
|
||||||
|
cm_clearLocalMountPointChange(); // clear the changefile
|
||||||
|
cm_reInitLocalMountPoints(); // start reinit
|
||||||
|
}
|
||||||
|
|
||||||
if (cm_getLocalMountPointChange()) { // check for changes
|
code = cm_NameI(cm_data.rootSCachep, cpath,
|
||||||
cm_clearLocalMountPointChange(); // clear the changefile
|
CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_DFS_REFERRAL,
|
||||||
cm_reInitLocalMountPoints(); // start reinit
|
cm_rootUserp, NULL, &req, &scp);
|
||||||
|
free(cpath);
|
||||||
|
if (code == 0) {
|
||||||
|
*fidp = scp->fid;
|
||||||
|
cm_ReleaseSCache(scp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
code = cm_NameI(cm_data.rootSCachep, cpath,
|
|
||||||
CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_DFS_REFERRAL,
|
|
||||||
cm_rootUserp, NULL, &req, &scp);
|
|
||||||
free(cpath);
|
|
||||||
if (code)
|
|
||||||
return code;
|
|
||||||
*fidp = scp->fid;
|
|
||||||
cm_ReleaseSCache(scp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
long cm_FreelanceRemoveSymlink(char *toremove)
|
long cm_FreelanceRemoveSymlink(char *toremove)
|
||||||
|
Loading…
Reference in New Issue
Block a user