public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: RHEL5 - rgmanager: randomize state dump file name Date: Thu, 21 May 2009 14:29:00 -0000 [thread overview] Message-ID: <20090521142824.C282C120298@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=5bf3964b3bebc418bbe970c55aabcfc7e5e57dba Commit: 5bf3964b3bebc418bbe970c55aabcfc7e5e57dba Parent: 210681e5612703a5b9f3e578db31e234cf58cb6d Author: Lon Hohberger <lhh@redhat.com> AuthorDate: Thu May 21 09:59:17 2009 -0400 Committer: Lon Hohberger <lhh@redhat.com> CommitterDate: Thu May 21 10:27:58 2009 -0400 rgmanager: randomize state dump file name --- rgmanager/src/daemons/main.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c index e23f8ef..94de2d3 100644 --- a/rgmanager/src/daemons/main.c +++ b/rgmanager/src/daemons/main.c @@ -694,10 +694,11 @@ void dump_vf_states(FILE *fp); void dump_cluster_ctx(FILE *fp); void -dump_internal_state(char *loc) +dump_internal_state(int fd) { FILE *fp; - fp=fopen(loc, "w+"); + + fp=fdopen(fd, "w+"); dump_config_version(fp); dump_threads(fp); dump_vf_states(fp); @@ -716,14 +717,20 @@ event_loop(msgctx_t *localctx, msgctx_t *clusterctx) msgctx_t *newctx; struct timeval tv; int nodeid; + char template[128] = "/tmp/rgmanager-dump.XXXXXX"; + int temp_fd = -1; tv.tv_sec = status_poll_interval; tv.tv_usec = 0; if (signalled) { signalled = 0; - - dump_internal_state("/tmp/rgmanager-dump"); + + temp_fd = mkstemp(template); + if (temp_fd >= 0) { + dump_internal_state(temp_fd); + close(temp_fd); + } } while (running && (tv.tv_sec || tv.tv_usec)) {
reply other threads:[~2009-05-21 14:29 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090521142824.C282C120298@lists.fedorahosted.org \ --to=lon@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).