mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-08-15 00:43:24 +00:00
Warn user of missing dirs and exit gracefully.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2262 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
bc87f196f7
commit
2d7937de26
@ -795,6 +795,7 @@ extern void coroipcs_ipc_init (
|
||||
int server_fd;
|
||||
struct sockaddr_un un_addr;
|
||||
int res;
|
||||
struct stat stat_out;
|
||||
|
||||
api = init_state;
|
||||
|
||||
@ -826,6 +827,11 @@ extern void coroipcs_ipc_init (
|
||||
#if defined(COROSYNC_LINUX)
|
||||
sprintf (un_addr.sun_path + 1, "%s", api->socket_name);
|
||||
#else
|
||||
res = stat (SOCKETDIR, &stat_out);
|
||||
if (res == -1 || (res == 0 && !S_ISDIR(stat_out.st_mode))) {
|
||||
api->log_printf ("Required directory not present %s\n", SOCKETDIR);
|
||||
api->fatal_error ("Please create required directory.");
|
||||
}
|
||||
sprintf (un_addr.sun_path, "%s/%s", SOCKETDIR, api->socket_name);
|
||||
unlink (un_addr.sun_path);
|
||||
#endif
|
||||
|
14
exec/main.c
14
exec/main.c
@ -45,6 +45,7 @@
|
||||
#include <sys/un.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/stat.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
@ -650,6 +651,8 @@ int main (int argc, char **argv)
|
||||
char *iface;
|
||||
int res, ch;
|
||||
int background, setprio;
|
||||
struct stat stat_out;
|
||||
char corosync_lib_dir[PATH_MAX];
|
||||
|
||||
#if defined(HAVE_PTHREAD_SPIN_LOCK)
|
||||
pthread_spin_init (&serialize_spin, 0);
|
||||
@ -811,6 +814,17 @@ int main (int argc, char **argv)
|
||||
res = logsys_thread_priority_set (SCHED_OTHER, NULL, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure required directory is present
|
||||
*/
|
||||
sprintf (corosync_lib_dir, "%s/lib/corosync", LOCALSTATEDIR);
|
||||
res = stat (corosync_lib_dir, &stat_out);
|
||||
if ((res == -1) || (res == 0 && !S_ISDIR(stat_out.st_mode))) {
|
||||
log_printf (LOGSYS_LEVEL_ERROR, "Required directory not present %s. Please create it.\n", corosync_lib_dir);
|
||||
corosync_exit_error (AIS_DONE_DIR_NOT_PRESENT);
|
||||
}
|
||||
|
||||
|
||||
res = totem_config_read (objdb, &totem_config, &error_string);
|
||||
if (res == -1) {
|
||||
log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
|
||||
|
@ -59,7 +59,8 @@ enum e_ais_done {
|
||||
AIS_DONE_OBJDB = -13,
|
||||
AIS_DONE_INIT_SERVICES = -14,
|
||||
AIS_DONE_OUT_OF_MEMORY = -15,
|
||||
AIS_DONE_FATAL_ERR = -16
|
||||
AIS_DONE_FATAL_ERR = -16,
|
||||
AIS_DONE_DIR_NOT_PRESENT = -17
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -177,6 +177,7 @@ int main (void) {
|
||||
|
||||
for (i = 0; i < 50; i++) { /* number of repetitions - up to 50k */
|
||||
cpg_benchmark (handle, size);
|
||||
signal (SIGALRM, sigalrm_handler);
|
||||
size += 1000;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user