fsInit fix

This commit is contained in:
smea 2014-08-24 22:50:57 -07:00
parent 3fae8817cc
commit fb1dc89eab
2 changed files with 13 additions and 2 deletions

View File

@ -14,6 +14,9 @@
/*! FSUSER handle */
static Handle fsuHandle;
// used to determine whether or not we should do FSUSER_Initialize on fsuHandle
Handle __get_handle_from_list(char* name);
/*! Initialize FS service
*
* @returns error
@ -21,7 +24,10 @@ static Handle fsuHandle;
Result
fsInit(void)
{
return srvGetServiceHandle(&fsuHandle, "fs:USER");
Result ret;
if((ret=srvGetServiceHandle(&fsuHandle, "fs:USER"))!=0)return ret;
if(__get_handle_from_list("fs:USER")==0)ret=FSUSER_Initialize(NULL);
return ret;
}
/*! Deinitialize FS service
@ -62,7 +68,12 @@ Result
FSUSER_Initialize(Handle* handle)
{
if(!handle)
{
// don't run command if we got handle from the list
handle = &fsuHandle;
if(fsuHandle != 0 && __get_handle_from_list("fs:USER")==0)
return 0;
}
u32 *cmdbuf = getThreadCommandBuffer();

View File

@ -47,7 +47,7 @@ static int __name_cmp(const char* a, const char* b) {
return 0;
}
static Handle __get_handle_from_list(char* name) {
Handle __get_handle_from_list(char* name) {
if((u32)__service_ptr == 0)
return 0;