advance write_to_pid_file in fdfs_storaged.c
parent
d91cd72bfd
commit
96f276a218
|
|
@ -139,11 +139,18 @@ int main(int argc, char *argv[])
|
||||||
daemon_init(false);
|
daemon_init(false);
|
||||||
umask(0);
|
umask(0);
|
||||||
|
|
||||||
|
if ((result=write_to_pid_file(pidFilename)) != 0)
|
||||||
|
{
|
||||||
|
log_destroy();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
memset(g_bind_addr, 0, sizeof(g_bind_addr));
|
memset(g_bind_addr, 0, sizeof(g_bind_addr));
|
||||||
if ((result=storage_func_init(conf_filename, \
|
if ((result=storage_func_init(conf_filename, \
|
||||||
g_bind_addr, sizeof(g_bind_addr))) != 0)
|
g_bind_addr, sizeof(g_bind_addr))) != 0)
|
||||||
{
|
{
|
||||||
logCrit("exit abnormally!\n");
|
logCrit("exit abnormally!\n");
|
||||||
|
delete_pid_file(pidFilename);
|
||||||
log_destroy();
|
log_destroy();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -152,6 +159,7 @@ int main(int argc, char *argv[])
|
||||||
if (sock < 0)
|
if (sock < 0)
|
||||||
{
|
{
|
||||||
logCrit("exit abnormally!\n");
|
logCrit("exit abnormally!\n");
|
||||||
|
delete_pid_file(pidFilename);
|
||||||
log_destroy();
|
log_destroy();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -159,12 +167,7 @@ int main(int argc, char *argv[])
|
||||||
if ((result=tcpsetserveropt(sock, g_fdfs_network_timeout)) != 0)
|
if ((result=tcpsetserveropt(sock, g_fdfs_network_timeout)) != 0)
|
||||||
{
|
{
|
||||||
logCrit("exit abnormally!\n");
|
logCrit("exit abnormally!\n");
|
||||||
log_destroy();
|
delete_pid_file(pidFilename);
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((result=write_to_pid_file(pidFilename)) != 0)
|
|
||||||
{
|
|
||||||
log_destroy();
|
log_destroy();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
@ -453,10 +456,10 @@ int main(int argc, char *argv[])
|
||||||
storage_trunk_destroy();
|
storage_trunk_destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete_pid_file(pidFilename);
|
||||||
logInfo("exit normally.\n");
|
logInfo("exit normally.\n");
|
||||||
log_destroy();
|
log_destroy();
|
||||||
|
|
||||||
delete_pid_file(pidFilename);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -417,10 +417,10 @@ int fdfs_parse_server_info_ex(char *server_str, const int default_port,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
*pColon = '\0';
|
||||||
port = atoi(pColon + 1);
|
port = atoi(pColon + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
*pColon = '\0';
|
|
||||||
conn = pServer->connections;
|
conn = pServer->connections;
|
||||||
pServer->count = splitEx(server_str, ',',
|
pServer->count = splitEx(server_str, ',',
|
||||||
hosts, FDFS_MULTI_IP_MAX_COUNT);
|
hosts, FDFS_MULTI_IP_MAX_COUNT);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue