#include "protocol/protocol.h"
#include "common/system.h"
+static char progpath[PATH_MAX];
static char *progname = NULL;
static char fcntl_lock(const char *file, int *outfd)
TALLOC_FREE(subreq);
if (! status) {
/* Ignore error */
- fprintf(stderr,
- "ctdb_mutex_fcntl_helper: "
- "tevent_wakeup_recv() failed\n");
+ fprintf(stderr, "%s: tevent_wakeup_recv() failed\n", progname);
}
if (kill(state->ppid, 0) == -1 && errno == ESRCH) {
ret = fstat(fd, &sb);
if (ret != 0) {
fprintf(stderr,
- "ctdb_mutex_fcntl_helper: "
+ "%s: "
"lock lost - lock file \"%s\" check failed (ret=%d)\n",
+ progname,
state->lock_file,
errno);
tevent_req_done(req);
TALLOC_FREE(subreq);
if (! status) {
/* Ignore error */
- fprintf(stderr,
- "ctdb_mutex_fcntl_helper: "
- "tevent_wakeup_recv() failed\n");
+ fprintf(stderr, "%s: tevent_wakeup_recv() failed\n", progname);
}
ret = stat(state->lock_file, &sb);
if (ret != 0) {
fprintf(stderr,
- "ctdb_mutex_fcntl_helper: "
+ "%s: "
"lock lost - lock file \"%s\" check failed (ret=%d)\n",
+ progname,
state->lock_file,
errno);
tevent_req_done(req);
if (sb.st_ino != state->inode) {
fprintf(stderr,
- "ctdb_mutex_fcntl_helper: "
- "lock lost - lock file \"%s\" inode changed\n",
+ "%s: lock lost - lock file \"%s\" inode changed\n",
+ progname,
state->lock_file);
tevent_req_done(req);
return;
if (! status) {
/* Ignore error */
fprintf(stderr,
- "ctdb_mutex_fcntl_helper: "
+ "%s: "
"wait_for_parent_recv() failed (%d)\n",
+ progname,
err);
}
if (! status) {
/* Ignore error */
fprintf(stderr,
- "ctdb_mutex_fcntl_helper: "
+ "%s: "
"wait_for_lost_recv() failed (%d)\n",
+ progname,
err);
}
struct tevent_req *req;
bool status;
- progname = argv[0];
+ strlcpy(progpath, argv[0], sizeof(progpath));
+ progname = basename(progpath);
if (argc < 2 || argc > 3) {
usage();