Patch from Hans to fix up the configurable /var/run and /etc/ais directory

support.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@955 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
Steven Dake 2006-03-24 18:25:55 +00:00
parent 064ffb17a1
commit 856c745591
5 changed files with 22 additions and 7 deletions

View File

@ -64,7 +64,7 @@ int main (void) {
*/
res = read (random_fd, key, sizeof (key));
if (res == -1) {
perror ("Could not read /etc/ais/authkey");
perror ("Could not read /dev/random");
exit (1);
}

View File

@ -1209,7 +1209,7 @@ int main (int argc, char **argv)
}
}
res = totem_config_keyread ("/etc/ais/authkey", &openais_config.totem_config, &error_string);
res = totem_config_keyread (OPENAIS_CONFDIR "/authkey", &openais_config.totem_config, &error_string);
if (res == -1) {
log_printf (LOG_LEVEL_ERROR, error_string);
openais_exit_error (AIS_DONE_MAINCONFIGREAD);

View File

@ -471,7 +471,7 @@ int totem_config_validate (
parse_error:
sprintf (error_string_response,
"parse error in /etc/ais/openais.conf: %s\n", error_reason);
"parse error in %s/openais.conf: %s\n", OPENAIS_CONFDIR, error_reason);
*error_string = error_string_response;
return (-1);
}

View File

@ -39,15 +39,25 @@ instantiate() {
}
terminate() {
echo clc_cli_script terminating up component $SA_AMF_COMPONENT_NAME on PID `cat /var/run/openais_cleanup_$SA_AMF_COMPONENT_NAME`
kill -15 `cat /var/run/openais_cleanup_$SA_AMF_COMPONENT_NAME`
if [ -w /var/run ]; then
PIDFILEPATH=/var/run
else
PIDFILEPATH=/tmp
fi
echo clc_cli_script terminating up component $SA_AMF_COMPONENT_NAME on PID `cat $PIDFILEPATH/openais_cleanup_$SA_AMF_COMPONENT_NAME`
kill -15 `cat $PIDFILEPATH/openais_cleanup_$SA_AMF_COMPONENT_NAME`
RETVAL=$?
return $RETVAL
}
cleanup() {
echo clc_cli_script cleaning up component $SA_AMF_COMPONENT_NAME on PID `cat /var/run/openais_cleanup_$SA_AMF_COMPONENT_NAME`
kill -9 `cat /var/run/openais_cleanup_$SA_AMF_COMPONENT_NAME`
if [ -w /var/run ]; then
PIDFILEPATH=/var/run
else
PIDFILEPATH=/tmp
fi
echo clc_cli_script cleaning up component $SA_AMF_COMPONENT_NAME on PID `cat $PIDFILEPATH/openais_cleanup_$SA_AMF_COMPONENT_NAME`
kill -9 `cat $PIDFILEPATH/openais_cleanup_$SA_AMF_COMPONENT_NAME`
RETVAL=$?
return $RETVAL
}

View File

@ -225,6 +225,11 @@ void write_pid (void) {
sprintf (filename, "/var/run/openais_cleanup_%s", compNameGlobal.value);
fd = open (filename, O_CREAT | O_TRUNC | O_RDWR, S_IRWXU);
if (fd == -1) {
printf("Failed using /var/run for pid file, using /tmp\n");
sprintf (filename, "/tmp/openais_cleanup_%s", compNameGlobal.value);
fd = open (filename, O_CREAT | O_TRUNC | O_RDWR, S_IRWXU);
}
sprintf (pid, "%d", getpid());
res = write (fd, pid, strlen (pid));
close (fd);