public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: fabbione@sourceware.org
To: cluster-cvs@sources.redhat.com, cluster-devel@redhat.com
Subject: Cluster Project branch, STABLE2, updated. cluster-2.03.04-24-g114dd2e
Date: Fri, 20 Jun 2008 14:46:00 -0000	[thread overview]
Message-ID: <20080620144610.21229.qmail@sourceware.org> (raw)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Cluster Project".

http://sources.redhat.com/git/gitweb.cgi?p=cluster.git;a=commitdiff;h=114dd2efb2e8219324a06948588f4e70f47b91d7

The branch, STABLE2 has been updated
       via  114dd2efb2e8219324a06948588f4e70f47b91d7 (commit)
       via  2ec282bd0ae2c9c86655e48744c93226101b1e23 (commit)
      from  1a500cfd7f8ed5e4e2b3beb02ef709d49bf925a6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 114dd2efb2e8219324a06948588f4e70f47b91d7
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date:   Fri Jun 20 16:44:47 2008 +0200

    [MISC] Fix previous cherry pick build failure in stable branch
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>

commit 2ec282bd0ae2c9c86655e48744c93226101b1e23
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
Date:   Wed May 7 09:54:12 2008 +0200

    [MISC] Fix build errors with Fedora default build options
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>

-----------------------------------------------------------------------

Summary of changes:
 cman/qdisk/daemon_init.c              |   13 +++++++++++--
 cman/qdisk/scandisk.c                 |   20 +++++++++++++++++---
 fence/agents/xvm/fence_xvm.c          |    4 +++-
 fence/agents/xvm/fence_xvmd.c         |    6 +++++-
 fence/agents/xvm/xml.c                |    2 +-
 rgmanager/src/clulib/cman.c           |    6 ++++--
 rgmanager/src/clulib/daemon_init.c    |   14 +++++++++++---
 rgmanager/src/clulib/msg_cluster.c    |   26 ++++++++++++++++++--------
 rgmanager/src/clulib/msgtest.c        |    3 ++-
 rgmanager/src/daemons/clurmtabd_lib.c |    2 +-
 rgmanager/src/daemons/main.c          |    3 ++-
 11 files changed, 75 insertions(+), 24 deletions(-)

diff --git a/cman/qdisk/daemon_init.c b/cman/qdisk/daemon_init.c
index dac66b7..460bef3 100644
--- a/cman/qdisk/daemon_init.c
+++ b/cman/qdisk/daemon_init.c
@@ -129,8 +129,13 @@ check_process_running(char *prog, pid_t * pid)
 	if (fp == NULL) {	/* error */
 		return 0;
 	}
-	fscanf(fp, "%d\n", &oldpid);
+
+	ret = fscanf(fp, "%d\n", &oldpid);
 	fclose(fp);
+
+	if ((ret == EOF) || (ret != 1))
+		return 0;
+
 	if (check_pid_valid(oldpid, cmd)) {
 		*pid = oldpid;
 		return 1;
@@ -213,7 +218,11 @@ daemon_init(char *prog)
 		exit(1);
 	}
 
-	daemon(0, 0);
+	if(daemon(0, 0)) {
+		fprintf(stderr, "daemon_init: Unable to daemonize.\n");
+		exit(1);
+	}
+
 
 	update_pidfile(prog);
 }
diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c
index b174822..820f63e 100644
--- a/cman/qdisk/scandisk.c
+++ b/cman/qdisk/scandisk.c
@@ -466,8 +466,13 @@ static int sysfs_is_dev(char *path, int *maj, int *min)
 	if (!lstat(newpath, &sb)) {
 		f = fopen(newpath, "r");
 		if (f) {
-			fscanf(f, "%d:%d", maj, min);
+			int err;
+
+			err = fscanf(f, "%d:%d", maj, min);
 			fclose(f);
+			if ((err == EOF) || (err != 2))
+				return -1;
+
 			return 1;
 		} else
 			return -1;
@@ -494,8 +499,12 @@ static int sysfs_is_removable(char *path)
 	if (!lstat(newpath, &sb)) {
 		f = fopen(newpath, "r");
 		if (f) {
-			fscanf(f, "%d\n", &i);
+			int err;
+
+			err = fscanf(f, "%d\n", &i);
 			fclose(f);
+			if ((err == EOF) || (err != 1))
+				i = -1;
 		}
 	}
 	return i;
@@ -586,9 +595,14 @@ static int sysfs_is_disk(char *path)
       found:
 	f = fopen(newpath, "r");
 	if (f) {
-		fscanf(f, "%d\n", &i);
+		int err;
+
+		err = fscanf(f, "%d\n", &i);
 		fclose(f);
 
+		if ((err == EOF) || (err != 1))
+			return 0;
+
 		switch (i) {
 		case 0x0:	/* scsi type_disk */
 		case 0xe:	/* found on ide disks from old kernels.. */
diff --git a/fence/agents/xvm/fence_xvm.c b/fence/agents/xvm/fence_xvm.c
index bf33557..e5847db 100644
--- a/fence/agents/xvm/fence_xvm.c
+++ b/fence/agents/xvm/fence_xvm.c
@@ -104,7 +104,9 @@ tcp_exchange(int fd, fence_auth_type_t auth, void *key,
 		return -1;
 
 	/* Read return code */
-	read(fd, &ret, 1);
+	if (read(fd, &ret, 1) < 0)
+		return -1;
+
 	close(fd);
 	if (ret == 0)
 		printf("Remote: Operation was successful\n");
diff --git a/fence/agents/xvm/fence_xvmd.c b/fence/agents/xvm/fence_xvmd.c
index e1f6638..e8d507e 100644
--- a/fence/agents/xvm/fence_xvmd.c
+++ b/fence/agents/xvm/fence_xvmd.c
@@ -742,7 +742,11 @@ main(int argc, char **argv)
 	/* XXX need to wait for child to successfully start before
 	   exiting... */
 	if (!(args.flags & F_FOREGROUND))
-		daemon(0,0);
+		if(daemon(0,0)) {
+			printf("Could not daemonize\n");
+			return 1;
+		}
+			
 
 	if (virInitialize() != 0) {
 		printf("Could not initialize libvirt\n");
diff --git a/fence/agents/xvm/xml.c b/fence/agents/xvm/xml.c
index 6a0308e..b3f8e53 100644
--- a/fence/agents/xvm/xml.c
+++ b/fence/agents/xvm/xml.c
@@ -184,7 +184,7 @@ xtree_writefile(const char *filename, xmlDocPtr xtree)
 	memset(&flock, 0, sizeof(flock));
 	flock.l_type = F_WRLCK;
 
-	fd = open(filename, O_WRONLY | O_CREAT | O_SYNC);
+	fd = open(filename, O_WRONLY | O_CREAT | O_SYNC, S_IRUSR | S_IWUSR );
 	if (fd == -1) {
 		n = errno;
 		close(tmpfd);
diff --git a/rgmanager/src/clulib/cman.c b/rgmanager/src/clulib/cman.c
index 4d77bbf..4e18aa8 100644
--- a/rgmanager/src/clulib/cman.c
+++ b/rgmanager/src/clulib/cman.c
@@ -68,7 +68,8 @@ cman_lock(int block, int preempt)
 
 		/* Try to wake up the holder! */
 		if (preempt)
-			write(_wakeup_pipe[1], "!", 1);
+			if(write(_wakeup_pipe[1], "!", 1) < 0)
+				goto out_unlock;
 
 		/* Blocking call; do the cond-thing */
 		pthread_cond_wait(&_chandle_cond, &_chandle_lock);
@@ -165,7 +166,8 @@ cman_unlock(cman_handle_t ch)
 
 	/* Empty wakeup pipe if we took it with the preempt flag */
 	if (_chandle_preempt)
-		read(_wakeup_pipe[0], &c, 1);
+		if(read(_wakeup_pipe[0], &c, 1) < 0)
+			goto out_unlock;
 
 	_chandle_preempt = 0;
 	_chandle_holder = 0;
diff --git a/rgmanager/src/clulib/daemon_init.c b/rgmanager/src/clulib/daemon_init.c
index bc0ccd6..234c780 100644
--- a/rgmanager/src/clulib/daemon_init.c
+++ b/rgmanager/src/clulib/daemon_init.c
@@ -131,8 +131,11 @@ check_process_running(char *prog, pid_t * pid)
 	if (fp == NULL) {	/* error */
 		return 0;
 	}
-	fscanf(fp, "%d\n", &oldpid);
+	ret = fscanf(fp, "%d\n", &oldpid);
 	fclose(fp);
+	if ((ret == EOF) || (ret != 1))
+		return 0;
+
 	if (check_pid_valid(oldpid, cmd)) {
 		*pid = oldpid;
 		return 1;
@@ -209,9 +212,14 @@ daemon_init(char *prog)
 		exit(1);
 	}
 
-	daemon(0, 0);
+	if (daemon(0, 0)) {
+		fprintf(stderr, "daemon_init: Unable to daemonize.\n");
+		exit(1);
+	}
 
 	update_pidfile(prog);
-	nice(-1);
+	if (nice(-1) < 0)
+		fprintf(stderr, "daemon_init: Unable to renice.\n");
+
 	//mlockall(MCL_CURRENT | MCL_FUTURE);
 }
diff --git a/rgmanager/src/clulib/msg_cluster.c b/rgmanager/src/clulib/msg_cluster.c
index e9b1bac..a5ffb66 100644
--- a/rgmanager/src/clulib/msg_cluster.c
+++ b/rgmanager/src/clulib/msg_cluster.c
@@ -318,7 +318,12 @@ cluster_msg_fd_set(msgctx_t *ctx, fd_set *fds, int *max)
 		   by the caller because the caller is switching to select()
 		   semantics. (as opposed to msg_wait() ) */
 		list_do(&ctx->u.cluster_info.queue, n) {
-			write(ctx->u.cluster_info.select_pipe[1], "", 1);
+			if (write(ctx->u.cluster_info.select_pipe[1], "", 1) < 0) {
+				e = errno;
+				pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
+				errno = e;
+				return -1;
+			}
 		} while (!list_done(&ctx->u.cluster_info.queue, n));
 	}
 
@@ -411,8 +416,10 @@ _cluster_msg_receive(msgctx_t *ctx, void **msg, size_t *len)
 
 	if (ctx->u.cluster_info.select_pipe[0] >= 0) {
 		//printf("%s read\n", __FUNCTION__);
-		read(ctx->u.cluster_info.select_pipe[0],
-	     	     &foo, 1);
+		if (read(ctx->u.cluster_info.select_pipe[0], &foo, 1) < 0) {
+			pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
+			return -1;
+		}
 	}
 
 	pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
@@ -516,8 +523,10 @@ cluster_msg_receive(msgctx_t *ctx, void *msg, size_t maxlen, int timeout)
 
 		if (ctx->u.cluster_info.select_pipe[0] >= 0) {
 			//printf("%s read\n", __FUNCTION__);
-			read(ctx->u.cluster_info.select_pipe[0],
-		     	     &foo, 1);
+			if (read(ctx->u.cluster_info.select_pipe[0], &foo, 1) < 0) {
+				pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
+				return -1;
+			}
 		}
 	
 		pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
@@ -844,6 +853,7 @@ cluster_msg_accept(msgctx_t *listenctx, msgctx_t *acceptctx)
 	cluster_msg_hdr_t *m;
 	msg_q_t *n;
 	char foo;
+	int err = 0;
 
 	if (!listenctx || !acceptctx)
 		return -1;
@@ -906,8 +916,8 @@ cluster_msg_accept(msgctx_t *listenctx, msgctx_t *acceptctx)
 
 			if (listenctx->u.cluster_info.select_pipe[0] >= 0) {
 				//printf("%s read\n", __FUNCTION__);
-				read(listenctx->u.cluster_info.select_pipe[0],
-				     &foo, 1);
+				if (read(listenctx->u.cluster_info.select_pipe[0], &foo, 1) < 0)
+					err = -1;
 			}
 
 			free(m);
@@ -915,7 +925,7 @@ cluster_msg_accept(msgctx_t *listenctx, msgctx_t *acceptctx)
 
 			/* Let the new context go. */
 			pthread_mutex_unlock(&acceptctx->u.cluster_info.mutex);
-			return 0;
+			return err;
 			/* notreached */
 
 		case M_DATA:
diff --git a/rgmanager/src/clulib/msgtest.c b/rgmanager/src/clulib/msgtest.c
index a65aabd..609cd10 100644
--- a/rgmanager/src/clulib/msgtest.c
+++ b/rgmanager/src/clulib/msgtest.c
@@ -227,7 +227,8 @@ main(int argc, char **argv)
 		select(max+1, &rfds, NULL, NULL, NULL);
 
 		if (FD_ISSET(STDIN_FILENO, &rfds)) {
-			fgets(recvbuf, 128, stdin);
+			if (!fgets(recvbuf, 128, stdin))
+				break;
 			if (recvbuf[0] == 'q' || recvbuf[0] == 'Q')
 				break;
 			if (msg_send(cluster_ctx, recvbuf,
diff --git a/rgmanager/src/daemons/clurmtabd_lib.c b/rgmanager/src/daemons/clurmtabd_lib.c
index d4b9bf5..7c869df 100644
--- a/rgmanager/src/daemons/clurmtabd_lib.c
+++ b/rgmanager/src/daemons/clurmtabd_lib.c
@@ -551,7 +551,7 @@ rmtab_read(rmtab_node **head, char *filename)
 	if (!fp) {
 		/* It's ok if it's not there. */
 		if (errno == ENOENT) {
-			close(open(filename, O_WRONLY|O_SYNC|O_CREAT));
+			close(open(filename, O_WRONLY|O_SYNC|O_CREAT, S_IRUSR | S_IWUSR));
 			return 0;
 		}
 		perror("fopen");
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
index a8cba13..9c4f842 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -55,10 +55,11 @@ void
 segfault(int __attribute__ ((unused)) sig)
 {
 	char ow[64];
+	int err; // dumb error checking... will be replaced by logsys
 
 	snprintf(ow, sizeof(ow)-1, "PID %d Thread %d: SIGSEGV\n", getpid(),
 		 gettid());
-	write(2, ow, strlen(ow));
+	err = write(2, ow, strlen(ow));
 	while(1)
 		sleep(60);
 }


hooks/post-receive
--
Cluster Project


                 reply	other threads:[~2008-06-20 14:46 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=20080620144610.21229.qmail@sourceware.org \
    --to=fabbione@sourceware.org \
    --cc=cluster-cvs@sources.redhat.com \
    --cc=cluster-devel@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: link
Be 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).