Beispiel #1
0
int checkCreateLink(const char *pszPath, const char *pszLink, int iRecreate)
{
    int iRes = 0;
    JUST_RETURN((NULL == pszPath) || ('\0' == pszPath[0]) || (NULL == pszLink) || ('\0' == pszLink[0]), -1);
    iRes = access(pszPath, R_OK);
    JUST_RETURN(-1 == iRes, -1);
    errno = 0;
    iRes = access(pszLink, R_OK);
    if (0 == iRes)
    {
        char szBuf[MAX_FILENAME_LEN];
        iRes = readlink(pszLink, szBuf, MAX_FILENAME_LEN - 1);
        JUST_RETURN(-1 == iRes, -1);
        szBuf[iRes] = '\0';
        JUST_RETURN(0 == strcmp(pszPath, szBuf), 0);
        JUST_RETURN(0 == iRecreate, -1);
        unlink(pszLink);
    }
    else
    {
        JUST_RETURN(errno != ENOENT, -1);
    }

    iRes = checkCreateDir(pszLink);
    JUST_RETURN(-1 == iRes, -1);
    iRes = symlink(pszPath, pszLink);
    JUST_RETURN(-1 == iRes, -1);
    return 0;
}
static void ethLoadModules(void) {
	int ret, ipconfiglen;
	char ipconfig[IPCONFIG_MAX_LEN] __attribute__((aligned(64)));

	LOG("ethLoadModules()\n");

	ipconfiglen = sysSetIPConfig(ipconfig);

	gNetworkStartup = 5;

	ret = sysLoadModuleBuffer(&ps2dev9_irx, size_ps2dev9_irx, 0, NULL);
	if (ret < 0) {
		gNetworkStartup = -1;
		return;
	}

	gNetworkStartup = 4;

	ret = sysLoadModuleBuffer(&smsutils_irx, size_smsutils_irx, 0, NULL);
	if (ret < 0) {
		gNetworkStartup = -1;
		return;
	}
	gNetworkStartup = 3;

	ret = sysLoadModuleBuffer(&smstcpip_irx, size_smstcpip_irx, 0, NULL);
	if (ret < 0) {
		gNetworkStartup = -1;
		return;
	}

	gNetworkStartup = 2;

	ret = sysLoadModuleBuffer(&smsmap_irx, size_smsmap_irx, ipconfiglen, ipconfig);
	if (ret < 0) {
		gNetworkStartup = -1;
		return;
	}

	gNetworkStartup = 1;

	ret = sysLoadModuleBuffer(&smbman_irx, size_smbman_irx, 0, NULL);
	if (ret < 0) {
		gNetworkStartup = -1;
		return;
	}

	gNetworkStartup = 0; // ok, all loaded

	LOG("ethLoadModules: modules loaded\n");

	// connect
	ethSMBConnect();

	// update Themes
	char path[255];
	sprintf(path, "%sTHM", ethPrefix);
	thmAddElements(path, "\\", ethGameList.mode);

#ifdef VMC
	sprintf(path, "%sVMC", ethPrefix);
	checkCreateDir(path);
#endif
}