This should be a fixed buffer.

This commit is contained in:
Roy Marples 2008-03-17 14:42:10 +00:00
parent b2f7606b23
commit 5d77c0db6b

View File

@ -478,7 +478,7 @@ bool rc_service_mark(const char *service, const RC_SERVICE state)
char *init = rc_service_resolve(service); char *init = rc_service_resolve(service);
bool skip_wasinactive = false; bool skip_wasinactive = false;
int s; int s;
char *was; char was[PATH_MAX];
RC_STRINGLIST *dirs; RC_STRINGLIST *dirs;
RC_STRING *dir; RC_STRING *dir;
int serrno; int serrno;
@ -495,7 +495,7 @@ bool rc_service_mark(const char *service, const RC_SERVICE state)
} }
snprintf(file, sizeof(file), RC_SVCDIR "/%s/%s", snprintf(file, sizeof(file), RC_SVCDIR "/%s/%s",
rc_parse_service_state (state), base); rc_parse_service_state(state), base);
if (exists(file)) if (exists(file))
unlink(file); unlink(file);
i = symlink(init, file); i = symlink(init, file);
@ -503,10 +503,9 @@ bool rc_service_mark(const char *service, const RC_SERVICE state)
free(init); free(init);
return false; return false;
} }
skip_state = state; skip_state = state;
} }
if (state == RC_SERVICE_COLDPLUGGED || state == RC_SERVICE_FAILED) { if (state == RC_SERVICE_COLDPLUGGED || state == RC_SERVICE_FAILED) {
free(init); free(init);
return true; return true;
@ -523,7 +522,7 @@ bool rc_service_mark(const char *service, const RC_SERVICE state)
(! skip_wasinactive || s != RC_SERVICE_WASINACTIVE)) (! skip_wasinactive || s != RC_SERVICE_WASINACTIVE))
{ {
snprintf(file, sizeof(file), RC_SVCDIR "/%s/%s", snprintf(file, sizeof(file), RC_SVCDIR "/%s/%s",
rc_parse_service_state(s), base); rc_service_state_names[i].name, base);
if (exists(file)) { if (exists(file)) {
if ((state == RC_SERVICE_STARTING || if ((state == RC_SERVICE_STARTING ||
state == RC_SERVICE_STOPPING) && state == RC_SERVICE_STOPPING) &&