Skip to content
Snippets Groups Projects
Commit 592fa176 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

hard code the location of the resolve symlink

parent d1afed35
No related branches found
No related tags found
No related merge requests found
......@@ -29,27 +29,22 @@ int state_write(ss_state_t *sta, resolve_service_t *res)
{
log_flow() ;
size_t len = strlen(res->sa.s + res->path.servicedir) ;
char target[len + SS_STATE_LEN + 1 + SS_STATUS_LEN + 1] ;
size_t len = strlen(res->sa.s + res->path.home) + SS_SYSTEM_LEN + SS_SERVICE_LEN + SS_SVC_LEN + 1 + strlen(res->sa.s + res->name) ;
char pack[STATE_STATE_SIZE] ;
char dir[len + SS_STATE_LEN + 1] ;
auto_strings(target, res->sa.s + res->path.servicedir, SS_STATE) ;
auto_strings(dir, res->sa.s + res->path.home, SS_SYSTEM, SS_SERVICE, SS_SVC, "/", res->sa.s + res->name, SS_STATE) ;
if (access(target, F_OK) < 0) {
log_trace("create directory: ", target) ;
if (!dir_create_parent(target, 0755))
log_warnusys_return(LOG_EXIT_ZERO, "create directory: ", target) ;
if (access(dir, F_OK) < 0) {
log_trace("create directory: ", dir) ;
if (!dir_create_parent(dir, 0755))
log_warnusys_return(LOG_EXIT_ZERO, "create directory: ", dir) ;
}
auto_strings(target + len + SS_STATE_LEN, "/", SS_STATUS) ;
char pack[STATE_STATE_SIZE] ;
state_pack(pack, sta) ;
log_trace("write status file at: ", target) ;
if (!openwritenclose_unsafe(target, pack, STATE_STATE_SIZE))
log_trace("write status file at: ", res->sa.s + res->path.status) ;
if (!openwritenclose_unsafe(res->sa.s + res->path.status, pack, STATE_STATE_SIZE))
return 0 ;
return 1 ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment