[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] Cluster Project branch, master, updated. cluster-2.99.00-22-g1edb73b



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=1edb73bd098500d459c16797da2377a59f1ef180

The branch, master has been updated
       via  1edb73bd098500d459c16797da2377a59f1ef180 (commit)
       via  98e9c1ac5ed0206872cccea8387c1f226313e6ef (commit)
      from  55d65d764259d17d051978e8fe9182f1045aef1b (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 1edb73bd098500d459c16797da2377a59f1ef180
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>

commit 98e9c1ac5ed0206872cccea8387c1f226313e6ef
Author: Fabio M. Di Nitto <fdinitto redhat com>
Date:   Tue May 6 16:18:26 2008 +0200

    [BUILD] Allow users to set path to init.d
    
    Almost all distributions use /etc/init.d but some still use
    the legacy path to /etc/rc.d/init.d.
    
    Allow builders to set the path instead of using some manual
    workarounds to do later fixup.
    
    Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>

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

Summary of changes:
 cman/qdisk/daemon_init.c              |   13 +++++++++++--
 cman/qdisk/scandisk.c                 |   20 +++++++++++++++++---
 configure                             |    7 +++++++
 fence/agents/xvm/fence_xvm.c          |    4 +++-
 fence/agents/xvm/fence_xvmd.c         |    6 +++++-
 fence/agents/xvm/xml.c                |    2 +-
 make/defines.mk.input                 |    1 +
 make/install.mk                       |    6 +++---
 make/uninstall.mk                     |    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 ++-
 15 files changed, 87 insertions(+), 28 deletions(-)

diff --git a/cman/qdisk/daemon_init.c b/cman/qdisk/daemon_init.c
index 21aebf2..0b5a6b8 100644
--- a/cman/qdisk/daemon_init.c
+++ b/cman/qdisk/daemon_init.c
@@ -150,8 +150,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;
@@ -234,7 +239,11 @@ daemon_init(char *prog)
 		exit(1);
 	}
 
-	daemon(0, 0);
+	if(daemon(0, 0)) {
+		log_printf(LOG_ERR, "daemon_init: Unable to daemonize.\n");
+		exit(1);
+	}
+
 
 	update_pidfile(prog);
 }
diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c
index 77484f6..528c1a5 100644
--- a/cman/qdisk/scandisk.c
+++ b/cman/qdisk/scandisk.c
@@ -485,8 +485,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;
@@ -513,8 +518,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;
@@ -595,9 +604,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/configure b/configure
index caf7d35..60ebe9e 100755
--- a/configure
+++ b/configure
@@ -81,6 +81,7 @@ my %options = (
 	mandir  => \$mandir,
 	prefix => \$prefix,
 	sbindir => \$sbindir,
+	initddir => \$initddir,
 	sharedir => \$sharedir,
 	logdir => \$logdir,
 	syslogfacility => \$syslogfacility,
@@ -158,6 +159,7 @@ my $err = &GetOptions (\%options,
 		    'mandir=s',
 		    'prefix=s',
 		    'sbindir=s',
+		    'initddir=s',
 		    'sharedir=s',
 		    'logdir=s',
 		    'syslogfacility=s',
@@ -197,6 +199,7 @@ if ($help || !$err) {
   print "install flags:\n";
   print "--prefix=\tthe base directory to install into.  (Default: /usr)\n";
   print "--sbindir=\tthe base directory for system binaries.  (Default: {prefix}/sbin)\n";
+  print "--initddir=\tthe base directory for init.d scripts.  (Default: /etc/init.d)\n";
   print "--libdir=\tthe base directory for libraries.  (Default: {prefix}/lib)\n";
   print "--libexecdir=\tthe base directory for executable components.  (Default: {prefix}/libexec)\n";
   print "--sharedir=\tthe base directory for misc cluster files.  (Default: {prefix}/share/cluster)\n";
@@ -520,6 +523,9 @@ if (!$mandir) {
 if (!$sbindir) {
   $sbindir="${prefix}/sbin";
 }
+if (!$initddir) {
+  $initddir="/etc/init.d";
+}
 if (!$sharedir) {
   $sharedir="${prefix}/share/cluster";
 }
@@ -673,6 +679,7 @@ while (<IFILE>) {
   $_ =~ s/\ LIBEXECDIR\@/$libexecdir/;
   $_ =~ s/\ MANDIR\@/$mandir/;
   $_ =~ s/\ SBINDIR\@/$sbindir/;
+  $_ =~ s/\ INITDDIR\@/$initddir/;
   $_ =~ s/\ SHAREDIR\@/$sharedir/;
   $_ =~ s/\ LOGDIR\@/$logdir/;
   $_ =~ s/\ SYSLOGFACILITY\@/$syslogfacility/;
diff --git a/fence/agents/xvm/fence_xvm.c b/fence/agents/xvm/fence_xvm.c
index 8c8ce64..14f02d8 100644
--- a/fence/agents/xvm/fence_xvm.c
+++ b/fence/agents/xvm/fence_xvm.c
@@ -122,7 +122,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 1280310..b9f9f36 100644
--- a/fence/agents/xvm/fence_xvmd.c
+++ b/fence/agents/xvm/fence_xvmd.c
@@ -765,7 +765,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 f313cc4..ccb946b 100644
--- a/fence/agents/xvm/xml.c
+++ b/fence/agents/xvm/xml.c
@@ -182,7 +182,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/make/defines.mk.input b/make/defines.mk.input
index ef9673f..bd6d37b 100644
--- a/make/defines.mk.input
+++ b/make/defines.mk.input
@@ -13,6 +13,7 @@
 
 # Install Locations
 sbindir ?= ${DESTDIR} SBINDIR@
+initddir ?= ${DESTDIR} INITDDIR@
 libdir ?= ${DESTDIR} LIBDIR@
 libexecdir ?= ${DESTDIR} LIBEXECDIR@
 sharedir ?= ${DESTDIR} SHAREDIR@
diff --git a/make/install.mk b/make/install.mk
index 9bc5f58..fb937ed 100644
--- a/make/install.mk
+++ b/make/install.mk
@@ -24,12 +24,12 @@ ifdef LCRSOT
 	install -m644 ${LCRSOT} ${libexecdir}/lcrso
 endif
 ifdef INITDT
-	install -d ${DESTDIR}/etc/init.d
+	install -d ${initddir}
 	for i in ${INITDT}; do \
 	  if [ -f $(S)/$$i ]; then \
-	    install -m755 $(S)/$$i ${DESTDIR}/etc/init.d; \
+	    install -m755 $(S)/$$i ${initddir}; \
 	  else \
-	    install -m755 $$i ${DESTDIR}/etc/init.d; \
+	    install -m755 $$i ${initddir}; \
 	  fi; \
 	done
 endif
diff --git a/make/uninstall.mk b/make/uninstall.mk
index 2d8094f..9e64522 100644
--- a/make/uninstall.mk
+++ b/make/uninstall.mk
@@ -18,7 +18,7 @@ ifdef LCRSOT
 	${UNINSTALL} ${LCRSOT} ${libexecdir}/lcrso
 endif
 ifdef INITDT
-	${UNINSTALL} ${INITDT} ${DESTDIR}/etc/init.d
+	${UNINSTALL} ${INITDT} ${initddir}
 endif
 ifdef UDEVT
 	${UNINSTALL} ${UDEVT} ${DESTDIR}/etc/udev/rules.d
diff --git a/rgmanager/src/clulib/cman.c b/rgmanager/src/clulib/cman.c
index 713fefd..278634a 100644
--- a/rgmanager/src/clulib/cman.c
+++ b/rgmanager/src/clulib/cman.c
@@ -86,7 +86,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);
@@ -183,7 +184,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 b05f2cd..6c88ba3 100644
--- a/rgmanager/src/clulib/daemon_init.c
+++ b/rgmanager/src/clulib/daemon_init.c
@@ -150,8 +150,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;
@@ -228,9 +231,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 dc0a7ea..fa70ac4 100644
--- a/rgmanager/src/clulib/msg_cluster.c
+++ b/rgmanager/src/clulib/msg_cluster.c
@@ -336,7 +336,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));
 	}
 
@@ -429,8 +434,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);
@@ -534,8 +541,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);
@@ -862,6 +871,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;
@@ -924,8 +934,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);
@@ -933,7 +943,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 6b90bab..4e26dea 100644
--- a/rgmanager/src/clulib/msgtest.c
+++ b/rgmanager/src/clulib/msgtest.c
@@ -245,7 +245,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 29fcd42..b0fa14e 100644
--- a/rgmanager/src/daemons/clurmtabd_lib.c
+++ b/rgmanager/src/daemons/clurmtabd_lib.c
@@ -569,7 +569,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 1e063ee..3b1dc83 100644
--- a/rgmanager/src/daemons/main.c
+++ b/rgmanager/src/daemons/main.c
@@ -74,10 +74,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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]