diff --git a/NEWS b/NEWS
index b3d91e472cc77ad43bc13611fc6f21ae34a96ed4..78ca5dc4d6107f76bca7e546a7d55da77cd2ab62 100644
--- a/NEWS
+++ b/NEWS
@@ -57,6 +57,7 @@ documents those changes that are of interest to users and admins.
 ========================
  -- Permit node suspend/resume logic to be enabled through "scontrol reconfig"
     given appropriate changes to slurm configuration file.
+ -- Check for return codes on functions with warn_unused_result set
 
 * Changes in SLURM 2.0.3
 ========================
diff --git a/doc/man/man5/slurm.conf.5 b/doc/man/man5/slurm.conf.5
index 820c98d5f07b99c62b1164e94e7da735cfc4ff8a..6927c310d492ce95bb0205c7a3d13b83c6e1c3a6 100644
--- a/doc/man/man5/slurm.conf.5
+++ b/doc/man/man5/slurm.conf.5
@@ -1630,17 +1630,19 @@ systems.
 .TP
 \fBUnkillableStepProgram\fR
 If the processes in a job step are determined to be unkillable for a period
-of time specified by the UnkillableStepTimeout variable, the program
-specified by the UnkillableStepProgram string will be executed.  This 
-program can be used to take special actions to clean up the unkillable
-processes.  The program will be run as the same user as the slurmd (usually
-"root").
+of time specified by the \fBUnkillableStepTimeout\fR variable, the program
+specified by \fBUnkillableStepProgram\fR will be executed.  
+This program can be used to take special actions to clean up the unkillable
+processes and/or notify computer administrators.  
+The program will be run \fBSlurmdUser\fR (usually "root"). 
+By default no program is run.
 
 .TP
 \fBUnkillableStepTimeout\fR
 The length of time, in seconds, that SLURM will wait before deciding that
 processes in a job step are unkillable (after they have been signaled with
-SIGKILL).  The default timeout value is 60 seconds.
+SIGKILL) and execute \fBUnkillableStepProgram\fR as described above.  
+The default timeout value is 60 seconds.
 
 .TP
 \fBUsePAM\fR
diff --git a/src/api/signal.c b/src/api/signal.c
index 3c89715e7e77732c2dcb28e17c219f94c1e814a8..7f59f7ffeab8682fe1391daeab5cba88a3ac71ba 100644
--- a/src/api/signal.c
+++ b/src/api/signal.c
@@ -149,7 +149,7 @@ slurm_signal_job_step (uint32_t job_id, uint32_t step_id, uint16_t signal)
 		    && step_info->job_steps[i].step_id == step_id) {
  			rc = _signal_job_step(&step_info->job_steps[i],
  					      alloc_info, signal);
- 			save_errno = errno;
+ 			save_errno = rc;
 			break;
 		}
 	}
diff --git a/src/common/assoc_mgr.c b/src/common/assoc_mgr.c
index befdea1a7ae054a082adf4cf74869cb0e9ae935c..e504d3ace819d72d4456c25e07872824598db641 100644
--- a/src/common/assoc_mgr.c
+++ b/src/common/assoc_mgr.c
@@ -2235,9 +2235,13 @@ extern int dump_assoc_mgr_state(char *state_save_location)
 		(void) unlink(new_file);
 	else {			/* file shuffle */
 		(void) unlink(old_file);
-		(void) link(reg_file, old_file);
+		if(link(reg_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       reg_file, old_file);
 		(void) unlink(reg_file);
-		(void) link(new_file, reg_file);
+		if(link(new_file, reg_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, reg_file);
 		(void) unlink(new_file);
 	}
 	xfree(old_file);
@@ -2302,9 +2306,13 @@ extern int dump_assoc_mgr_state(char *state_save_location)
 		(void) unlink(new_file);
 	else {			/* file shuffle */
 		(void) unlink(old_file);
-		(void) link(reg_file, old_file);
+		if(link(reg_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       reg_file, old_file);
 		(void) unlink(reg_file);
-		(void) link(new_file, reg_file);
+		if(link(new_file, reg_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, reg_file);
 		(void) unlink(new_file);
 	}
 	xfree(old_file);
diff --git a/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c b/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c
index 8744f4e497da379be9412840ef92d8da2c0bbc7b..4e94c04c307b70a34a899ba3dda600b94914fbdb 100644
--- a/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c
+++ b/src/plugins/accounting_storage/filetxt/filetxt_jobacct_process.c
@@ -1398,7 +1398,9 @@ extern int filetxt_jobacct_process_archive(acct_archive_cond_t *arch_cond)
 	
 	if (new_file) {  /* By default, the expired file looks like the log */
 		chmod(logfile_name, prot);
-		chown(logfile_name, uid, gid);
+		if(chown(logfile_name, uid, gid) == -1)
+			error("Couldn't change ownership of %s to %u:%u",
+			      logfile_name, uid, gid);
 	}
 	xfree(logfile_name);
 
@@ -1411,7 +1413,9 @@ extern int filetxt_jobacct_process_archive(acct_archive_cond_t *arch_cond)
 		goto finished;
 	}
 	chmod(logfile_name, prot);     /* preserve file protection */
-	chown(logfile_name, uid, gid); /* and ownership */
+	if(chown(logfile_name, uid, gid) == -1)/* and ownership */
+		error("2 Couldn't change ownership of %s to %u:%u",
+		      logfile_name, uid, gid);
 	/* Use line buffering to allow us to safely write
 	 * to the log file at the same time as slurmctld. */ 
 	if (setvbuf(new_logfile, NULL, _IOLBF, 0)) {
diff --git a/src/plugins/priority/multifactor/priority_multifactor.c b/src/plugins/priority/multifactor/priority_multifactor.c
index 980b6eae233293b42959605cd1320d3ae68740c7..b7940509650bc6e5d378e4e22be1fa1b163eff8f 100644
--- a/src/plugins/priority/multifactor/priority_multifactor.c
+++ b/src/plugins/priority/multifactor/priority_multifactor.c
@@ -312,9 +312,13 @@ static int _write_last_decay_ran(time_t last_ran, time_t last_reset)
 		(void) unlink(new_file);
 	else {			/* file shuffle */
 		(void) unlink(old_file);
-		(void) link(state_file, old_file);
+		if(link(state_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       state_file, old_file);
 		(void) unlink(state_file);
-		(void) link(new_file, state_file);
+		if(link(new_file, state_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, state_file);
 		(void) unlink(new_file);
 	}
 	xfree(old_file);
diff --git a/src/plugins/proctrack/linuxproc/kill_tree.c b/src/plugins/proctrack/linuxproc/kill_tree.c
index d4c480394254738dbe90fd48b9b5d8c0390a51a1..08773f72334cd7375f696421d3b1da9901132d11 100644
--- a/src/plugins/proctrack/linuxproc/kill_tree.c
+++ b/src/plugins/proctrack/linuxproc/kill_tree.c
@@ -151,7 +151,7 @@ static xppid_t **_build_hashtbl()
 	char path[PATH_MAX], *endptr, *num, rbuf[1024];
 	char myname[1024], cmd[1024];
 	int fd;
-	long pid, ppid;
+	long pid, ppid, ret_l;
 	xppid_t **hashtbl;
 
 	if ((dir = opendir("/proc")) == NULL) {
@@ -165,7 +165,11 @@ static xppid_t **_build_hashtbl()
 
 	while ((de = readdir(dir)) != NULL) {
 		num = de->d_name;
-		strtol(num, &endptr, 10);
+		ret_l = strtol(num, &endptr, 10);
+		if(errno == ERANGE)
+			error("couldn't do a strtol on str %s(%d): %m",
+			      num, ret_l);
+
 		if (endptr == NULL || *endptr != 0)
 			continue;
 		sprintf(path, "/proc/%s/stat", num);
diff --git a/src/plugins/select/bluegene/plugin/select_bluegene.c b/src/plugins/select/bluegene/plugin/select_bluegene.c
index 65d1b943b29bf397187338f47a8a9e566e43d506..3280fadb725acca446db09518204ae636924c156 100644
--- a/src/plugins/select/bluegene/plugin/select_bluegene.c
+++ b/src/plugins/select/bluegene/plugin/select_bluegene.c
@@ -399,9 +399,13 @@ extern int select_p_state_save(char *dir_name)
 		(void) unlink(new_file);
 	else {			/* file shuffle */
 		(void) unlink(old_file);
-		(void) link(reg_file, old_file);
+		if(link(reg_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       reg_file, old_file);
 		(void) unlink(reg_file);
-		(void) link(new_file, reg_file);
+		if(link(new_file, reg_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, reg_file);
 		(void) unlink(new_file);
 	}
 	xfree(old_file);
diff --git a/src/sacctmgr/sacctmgr.c b/src/sacctmgr/sacctmgr.c
index c10b30cd4c898d3d97e64135b48618c6940d3100..b62c43033dcc2df1a5e9c3a06b6e3e1ae2d57e9e 100644
--- a/src/sacctmgr/sacctmgr.c
+++ b/src/sacctmgr/sacctmgr.c
@@ -240,7 +240,9 @@ getline(const char *prompt)
 	int len;
 	printf("%s", prompt);
 
-	fgets(buf, 4096, stdin);
+	/* we only set this here to avoid a warning.  We throw it away
+	   later. */
+	line = fgets(buf, 4096, stdin);
 	len = strlen(buf);
 	if ((len > 0) && (buf[len-1] == '\n'))
 		buf[len-1] = '\0';
diff --git a/src/scancel/scancel.c b/src/scancel/scancel.c
index e97412cdef9f8cf37ddc74d8cf4fff71bcd002d2..b0bda4be81105baa1b0cfa794ab9697e963fefb7 100644
--- a/src/scancel/scancel.c
+++ b/src/scancel/scancel.c
@@ -497,6 +497,7 @@ _confirmation (int i, uint32_t step_id)
 {
 	char in_line[128];
 	job_info_t *job_ptr = NULL;
+	char *line = NULL;
 
 	job_ptr = job_buffer_ptr->job_array ;
 	while (1) {
@@ -510,7 +511,9 @@ _confirmation (int i, uint32_t step_id)
 				job_ptr[i].partition);
 		}
 
-		fgets (in_line, sizeof (in_line), stdin);
+		/* we only set this here to avoid a warning.  We throw it away
+		   later. */
+		line = fgets (in_line, sizeof (in_line), stdin);
 		if ((in_line[0] == 'y') || (in_line[0] == 'Y'))
 			return 1;
 		if ((in_line[0] == 'n') || (in_line[0] == 'N'))
diff --git a/src/scontrol/scontrol.c b/src/scontrol/scontrol.c
index 9ab93c19a414fb89798fc19778b8c0add2a9c382..dacbbcb079509959f8d0256678c6eafeacddc806 100644
--- a/src/scontrol/scontrol.c
+++ b/src/scontrol/scontrol.c
@@ -199,7 +199,10 @@ getline(const char *prompt)
 
 	printf("%s", prompt);
 
-	fgets(buf, 4096, stdin);
+	/* we only set this here to avoid a warning.  We throw it away
+	   later. */
+	line = fgets(buf, 4096, stdin);
+
 	len = strlen(buf);
 	if ((len > 0) && (buf[len-1] == '\n'))
 		buf[len-1] = '\0';
diff --git a/src/scontrol/update_job.c b/src/scontrol/update_job.c
index 7b9ea058bb715f15a2b7cc6cef95e48e1f60d7e9..98d0833c78fd248ab727abbd09517fa015ac7551 100644
--- a/src/scontrol/update_job.c
+++ b/src/scontrol/update_job.c
@@ -87,12 +87,10 @@ scontrol_checkpoint(char *op, char *job_step_id_str, int argc, char *argv[])
 		rc = slurm_checkpoint_able (job_id, step_id, &start_time);
 		if (rc == SLURM_SUCCESS) {
 			if (start_time) {
-				char buf[128], time_str[32];
+				char time_str[32];
 				slurm_make_time_str(&start_time, time_str,
-					sizeof(time_str));
-				snprintf(buf, sizeof(buf), 
-					"Began at %s\n", time_str); 
-				printf(buf);
+						    sizeof(time_str));
+				printf("Began at %s\n", time_str);
 			} else
 				printf("Yes\n");
 		} else if (slurm_get_errno() == ESLURM_DISABLED) {
@@ -566,7 +564,7 @@ scontrol_job_notify(int argc, char *argv[])
 {
 	int i;
 	uint32_t job_id;
-	char message[256];
+	char *message = NULL;
 
 	job_id = atoi(argv[0]);
 	if (job_id <= 0) {
@@ -574,14 +572,17 @@ scontrol_job_notify(int argc, char *argv[])
 		return 1;
 	}
 
-	message[0] = '\0';
 	for (i=1; i<argc; i++) {
-		if (i > 1)
-			strncat(message, " ", sizeof(message));
-		strncat(message, argv[i], sizeof(message));
+		if (message)
+			xstrfmtcat(message, " %s", argv[i]);
+		else
+			xstrcat(message, argv[i]);
 	}
-			
-	if (slurm_notify_job(job_id, message))
+
+	i = slurm_notify_job(job_id, message);
+	xfree(message);
+
+	if (i)
 		return slurm_get_errno ();
 	else
 		return 0;
diff --git a/src/slurmctld/agent.c b/src/slurmctld/agent.c
index e646aebd307ae72151ba88ece4c84230bc059136..2ac612f8886e467b17370fe384fd0ac22a7d05cb 100644
--- a/src/slurmctld/agent.c
+++ b/src/slurmctld/agent.c
@@ -1413,9 +1413,11 @@ static void _mail_proc(mail_info_t *mi)
 		(void) close(0);
 		(void) close(1);
 		(void) close(2);
-		fd = open("/dev/null", O_RDWR);
-		dup(fd);
-		dup(fd);
+		fd = open("/dev/null", O_RDWR); // 0
+		if(dup(fd) == -1) // 1
+			error("Couldn't do a dup for 1: %m");
+		if(dup(fd) == -1) // 2
+			error("Couldn't do a dup for 2 %m");
 		execle(slurmctld_conf.mail_prog, "mail", 
 			"-s", mi->message, mi->user_name,
 			NULL, NULL);
diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index 4a9bfb3c12b2f5952b49ce8716e85397f72f61f7..58f013bea731133b2183a105c4bf0472dee9ffb6 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -386,9 +386,13 @@ int dump_all_job_state(void)
 		(void) unlink(new_file);
 	else {			/* file shuffle */
 		(void) unlink(old_file);
-		(void) link(reg_file, old_file);
+		if(link(reg_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       reg_file, old_file);
 		(void) unlink(reg_file);
-		(void) link(new_file, reg_file);
+		if(link(new_file, reg_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, reg_file);
 		(void) unlink(new_file);
 	}
 	xfree(old_file);
@@ -7223,9 +7227,13 @@ static int _checkpoint_job_record (struct job_record *job_ptr, char *image_dir)
 		(void) unlink(new_file);
 	else {			/* file shuffle */
 		(void) unlink(old_file);
-		(void) link(ckpt_file, old_file);
+		if(link(ckpt_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       ckpt_file, old_file);
 		(void) unlink(ckpt_file);
-		(void) link(new_file, ckpt_file);
+		if(link(new_file, ckpt_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, ckpt_file);
 		(void) unlink(new_file);
 	}
 
diff --git a/src/slurmctld/node_mgr.c b/src/slurmctld/node_mgr.c
index ad04a6cea2364109570fc85b013b16649fa9f925..9bd16c516610a6bdaeaf1cdd97f9e83e79c7df6f 100644
--- a/src/slurmctld/node_mgr.c
+++ b/src/slurmctld/node_mgr.c
@@ -309,9 +309,13 @@ int dump_all_node_state ( void )
 		(void) unlink (new_file);
 	else {	/* file shuffle */
 		(void) unlink (old_file);
-		(void) link (reg_file, old_file);
+		if(link(reg_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       reg_file, old_file);
 		(void) unlink (reg_file);
-		(void) link (new_file, reg_file);
+		if(link(new_file, reg_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, reg_file);
 		(void) unlink (new_file);
 	}
 	xfree (old_file);
diff --git a/src/slurmctld/partition_mgr.c b/src/slurmctld/partition_mgr.c
index 9b6b859d39e6f49f257a566625c38100a4204db7..5b791995acb026a0a2a692d652e6f9ea58b6f766 100644
--- a/src/slurmctld/partition_mgr.c
+++ b/src/slurmctld/partition_mgr.c
@@ -354,9 +354,13 @@ int dump_all_part_state(void)
 		(void) unlink(new_file);
 	else {			/* file shuffle */
 		(void) unlink(old_file);
-		(void) link(reg_file, old_file);
+		if(link(reg_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       reg_file, old_file);
 		(void) unlink(reg_file);
-		(void) link(new_file, reg_file);
+		if(link(new_file, reg_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, reg_file);
 		(void) unlink(new_file);
 	}
 	xfree(old_file);
diff --git a/src/slurmctld/reservation.c b/src/slurmctld/reservation.c
index a6bdfee4b9576a9a1bde28fe76bca1668f2de027..80bc8aa0eaafcdb07b748acd34ca9348b2e1d42a 100644
--- a/src/slurmctld/reservation.c
+++ b/src/slurmctld/reservation.c
@@ -1691,9 +1691,13 @@ extern int dump_all_resv_state(void)
 		(void) unlink(new_file);
 	else {			/* file shuffle */
 		(void) unlink(old_file);
-		(void) link(reg_file, old_file);
+		if(link(reg_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       reg_file, old_file);
 		(void) unlink(reg_file);
-		(void) link(new_file, reg_file);
+		if(link(new_file, reg_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, reg_file);
 		(void) unlink(new_file);
 	}
 	xfree(old_file);
diff --git a/src/slurmctld/trigger_mgr.c b/src/slurmctld/trigger_mgr.c
index 2116367b77345d20be7383f9a3186e0bc7de2738..f04d82f48dda1be8b748c8a71cb6292d033f78a9 100644
--- a/src/slurmctld/trigger_mgr.c
+++ b/src/slurmctld/trigger_mgr.c
@@ -583,9 +583,13 @@ extern int trigger_state_save(void)
 		(void) unlink(new_file);
 	else {			/* file shuffle */
 		(void) unlink(old_file);
-		(void) link(reg_file, old_file);
+		if(link(reg_file, old_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       reg_file, old_file);
 		(void) unlink(reg_file);
-		(void) link(new_file, reg_file);
+		if(link(new_file, reg_file))
+			debug4("unable to create link for %s -> %s: %m",
+			       new_file, reg_file);
 		(void) unlink(new_file);
 	}
 	xfree(old_file);
diff --git a/src/slurmd/slurmd/req.c b/src/slurmd/slurmd/req.c
index 5e6546c9bb85978b8d926815b22df5adf0e58ea5..fdfca2176f9acac1cdad8e01d6609f74098a6ae9 100644
--- a/src/slurmd/slurmd/req.c
+++ b/src/slurmd/slurmd/req.c
@@ -924,8 +924,12 @@ _prolog_error(batch_job_launch_msg_t *req, int rc)
 	}
 	snprintf(err_name, 128, "Error running slurm prolog: %d\n", 
 		WEXITSTATUS(rc));
-	write(fd, err_name, strlen(err_name));
-	fchown(fd, (uid_t) req->uid, (gid_t) req->gid);
+	safe_write(fd, err_name, strlen(err_name));
+	if(fchown(fd, (uid_t) req->uid, (gid_t) req->gid) == -1)
+		snprintf(err_name, 128,
+			 "Couldn't change fd owner to %u:%u: %m\n", 
+			 req->uid, req->gid);
+rwfail:
 	close(fd);
 }
 
@@ -3422,7 +3426,11 @@ _getgroups(void)
 		return NULL;
 	}
 	gg = (gid_t *)xmalloc(n * sizeof(gid_t));
-	getgroups(n, gg);
+	if(getgroups(n, gg) == -1) {
+		error("_getgroups: couldn't get %d groups: %m", n);
+		xfree(gg);
+		return NULL;
+	}
 	return _alloc_gids(n, gg);
 }
 
@@ -3449,7 +3457,11 @@ init_gids_cache(int cache)
 		return;
 	}
 	orig_gids = (gid_t *)xmalloc(ngids * sizeof(gid_t));
-	getgroups(ngids, orig_gids);
+	if(getgroups(ngids, orig_gids) == -1) {
+		error("init_gids_cache: couldn't get %d groups: %m", ngids);
+		xfree(orig_gids);
+		return;
+	}
 
 #ifdef HAVE_AIX
 	setpwent_r(&fp);
diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
index 58cc1cc5bdac39ff7b46d6875389d6a0984dafb3..5c326ca2412e8dbb8ce1f47a7882e3f281ba4c4a 100644
--- a/src/slurmd/slurmd/slurmd.c
+++ b/src/slurmd/slurmd/slurmd.c
@@ -241,7 +241,8 @@ main (int argc, char *argv[])
 	 * Do not chdir("/") or close all fd's
 	 */
 	if (conf->daemonize) 
-		daemon(1,1);
+		if(daemon(1,1) == -1) 
+			error("Couldn't daemonize slurmd: %m");
 	info("slurmd version %s started", SLURM_VERSION);
 	debug3("finished daemonize");
 
@@ -1210,9 +1211,13 @@ int save_cred_state(slurm_cred_ctx_t ctx)
 		goto cleanup;
 	}
 	(void) unlink(old_file);
-	(void) link(reg_file, old_file);
+	if(link(reg_file, old_file))
+		debug4("unable to create link for %s -> %s: %m",
+		       reg_file, old_file);
 	(void) unlink(reg_file);
-	(void) link(new_file, reg_file);
+	if(link(new_file, reg_file))
+		debug4("unable to create link for %s -> %s: %m",
+		       new_file, reg_file);
 	(void) unlink(new_file);
 
 cleanup:
diff --git a/src/slurmd/slurmstepd/mgr.c b/src/slurmd/slurmstepd/mgr.c
index c6267cf5868efb00cb189ac9a56129e9e221f92d..b29735a4edf57f7cb95a3f2529db387ed346b92d 100644
--- a/src/slurmd/slurmstepd/mgr.c
+++ b/src/slurmd/slurmstepd/mgr.c
@@ -1677,7 +1677,12 @@ _drop_privileges(slurmd_job_t *job, bool do_setuid, struct priv_state *ps)
 
 	ps->gid_list = (gid_t *) xmalloc(ps->ngids * sizeof(gid_t));
 
-	getgroups(ps->ngids, ps->gid_list);
+	if(getgroups(ps->ngids, ps->gid_list) == -1) {
+		error("_drop_privileges: couldn't get %d groups: %m",
+		      ps->ngids);
+		xfree(ps->gid_list);
+		return -1;
+	}
 
 	/*
 	 * No need to drop privileges if we're not running as root
@@ -1962,7 +1967,9 @@ _run_script_as_user(const char *name, const char *path, slurmd_job_t *job,
 			exit(127);
 		}
 
-		chdir(job->cwd);
+		if(chdir(job->cwd) == -1)
+			error("run_script_as_user: couldn't "
+			      "change working dir to %s: %m", job->cwd);
 #ifdef SETPGRP_TWO_ARGS
 		setpgrp(0, 0);
 #else
diff --git a/src/slurmd/slurmstepd/task.c b/src/slurmd/slurmstepd/task.c
index 8493d7322d092737ce52db0e52a9f34fc7545e43..ffde558c3f93a5f33d3500314cc631f146b3e57c 100644
--- a/src/slurmd/slurmstepd/task.c
+++ b/src/slurmd/slurmstepd/task.c
@@ -154,13 +154,15 @@ static void _print_stdout(char *buf)
 		buf_ptr = tmp_ptr + 6;
 		tmp_ptr = strchr(buf_ptr, '\n');
 		if (tmp_ptr) {
-			write(1, buf_ptr, (tmp_ptr - buf_ptr + 1));
+			safe_write(1, buf_ptr, (tmp_ptr - buf_ptr + 1));
 			buf_ptr = tmp_ptr + 1;
 		} else {
-			write(1, buf_ptr, strlen(buf_ptr));
+			safe_write(1, buf_ptr, strlen(buf_ptr));
 			break;
 		}
 	}		
+rwfail:
+	return;
 }
 
 /*
@@ -205,7 +207,8 @@ _run_script_and_set_env(const char *name, const char *path, slurmd_job_t *job)
 		argv[0] = xstrdup(path);
 		argv[1] = NULL;
 		close(1);
-		dup(pfd[1]);
+		if(dup(pfd[1]) == -1)
+			error("couldn't do the dup: %m");
 		close(2);
 		close(0);
 #ifdef SETPGRP_TWO_ARGS
diff --git a/src/smap/configure_functions.c b/src/smap/configure_functions.c
index b098c5297f732349beee2099bb63aeed7227d438..35bd8dfc5448b23dfd17a0f6c267e2f71cab7b82 100644
--- a/src/smap/configure_functions.c
+++ b/src/smap/configure_functions.c
@@ -573,8 +573,11 @@ static int _resolve(char *com)
 	int *coord = NULL;
 #endif
 	
-	while(com[i-1] != ' ' && com[i] != '\0')
+	while(com[i] != '\0') {
+		if((i>0) && (com[i-1] != ' '))
+			break;
 		i++;
+	}
 	if(com[i] == 'r')
 		com[i] = 'R';
 		
@@ -893,7 +896,9 @@ static int _copy_allocation(char *com, List allocated_blocks)
 	int count = 1;
 	int *geo = NULL, *geo_ptr = NULL;
 			
-	while(com[i-1]!=' ' && i<=len) {
+	while(i<=len) {
+		if((i>0) && (com[i-1] != ' '))
+			break;
 		i++;
 	}
 	
diff --git a/src/sreport/sreport.c b/src/sreport/sreport.c
index c69f93e8befd021cff7d4ed13a136bd441258118..9dd1a8134c6c1873c1b03d8bda3ddc1565ea78b2 100644
--- a/src/sreport/sreport.c
+++ b/src/sreport/sreport.c
@@ -209,7 +209,9 @@ getline(const char *prompt)
 	int len;
 	printf("%s", prompt);
 
-	fgets(buf, 4096, stdin);
+	/* we only set this here to avoid a warning.  We throw it away
+	   later. */
+	line = fgets(buf, 4096, stdin);
 	len = strlen(buf);
 	if ((len > 0) && (buf[len-1] == '\n'))
 		buf[len-1] = '\0';
diff --git a/src/srun/allocate.c b/src/srun/allocate.c
index c85debe50fab85085d19e9894806b649a3940f43..a52a56b9725a494abc5210732a6828201aed571b 100644
--- a/src/srun/allocate.c
+++ b/src/srun/allocate.c
@@ -487,7 +487,7 @@ slurmctld_msg_init(void)
 {
 	slurm_addr slurm_address;
 	uint16_t port;
-	static slurm_fd slurmctld_fd   = (slurm_fd) NULL;
+	static slurm_fd slurmctld_fd   = (slurm_fd) 0;
 
 	if (slurmctld_fd)	/* May set early for queued job allocation */
 		return slurmctld_fd;
diff --git a/src/sview/common.c b/src/sview/common.c
index b8b5e983428b2569ec2ee18b2fced3a45d8bf94c..43f69091ac18a6efe92b5b3ecc5f02508281b9af 100644
--- a/src/sview/common.c
+++ b/src/sview/common.c
@@ -175,7 +175,7 @@ cleanup:
  */
 static int _bp_coordinate(const char *name)
 {
-	int i, io_val = 999, low_val = -1, high_val;
+	int i, io_val = 999, low_val = -1, high_val = -1;
 
 	for (i=0; name[i]; i++) {
 		if (name[i] == '[') {
diff --git a/testsuite/expect/test1.29.prog.c b/testsuite/expect/test1.29.prog.c
index a6ab4edcfd9c0ec79672586259c5caea4f6206e9..def3342732b5e8d7f7f34c4831f2baaa9cb9306b 100644
--- a/testsuite/expect/test1.29.prog.c
+++ b/testsuite/expect/test1.29.prog.c
@@ -38,20 +38,20 @@ main (int argc, char **argv)
 	int exit_code = 0;
 
 	(void) getrlimit(RLIMIT_CORE, &u_limit);
-	printf("USER_CORE=%d\n", u_limit.rlim_cur);
+	printf("USER_CORE=%d\n", (int)u_limit.rlim_cur);
 	(void) getrlimit(RLIMIT_FSIZE, &u_limit);
-	printf("USER_FSIZE=%d\n", u_limit.rlim_cur);
+	printf("USER_FSIZE=%d\n", (int)u_limit.rlim_cur);
 	(void) getrlimit(RLIMIT_NOFILE, &u_limit);
-	printf("USER_NOFILE=%d\n", u_limit.rlim_cur);
+	printf("USER_NOFILE=%d\n", (int)u_limit.rlim_cur);
 #ifdef RLIMIT_NPROC
 	(void) getrlimit(RLIMIT_NPROC, &u_limit);
-	printf("USER_NPROC=%d\n", u_limit.rlim_cur);
+	printf("USER_NPROC=%d\n", (int)u_limit.rlim_cur);
 #else
 	printf("USER_NPROC unsupported\n");
 #endif
 #ifdef RLIMIT_STACK
         (void) getrlimit(RLIMIT_STACK, &u_limit);
-        printf("USER_STACK=%d\n", u_limit.rlim_cur);
+        printf("USER_STACK=%d\n", (int)u_limit.rlim_cur);
 #else
         printf("USER_STACK unsupported\n");
 #endif
diff --git a/testsuite/expect/test17.15.prog.c b/testsuite/expect/test17.15.prog.c
index e680f327794cade32485ab5a158031194d000c68..5c98849257644fccdbf1cea97113d1ff50dabcc1 100644
--- a/testsuite/expect/test17.15.prog.c
+++ b/testsuite/expect/test17.15.prog.c
@@ -38,20 +38,20 @@ main (int argc, char **argv)
 	int exit_code = 0;
 
 	(void) getrlimit(RLIMIT_CORE, &u_limit);
-	printf("USER_CORE=%d\n", u_limit.rlim_cur);
+	printf("USER_CORE=%d\n", (int)u_limit.rlim_cur);
 	(void) getrlimit(RLIMIT_FSIZE, &u_limit);
-	printf("USER_FSIZE=%d\n", u_limit.rlim_cur);
+	printf("USER_FSIZE=%d\n", (int)u_limit.rlim_cur);
 	(void) getrlimit(RLIMIT_NOFILE, &u_limit);
-	printf("USER_NOFILE=%d\n", u_limit.rlim_cur);
+	printf("USER_NOFILE=%d\n", (int)u_limit.rlim_cur);
 #ifdef RLIMIT_NPROC
 	(void) getrlimit(RLIMIT_NPROC, &u_limit);
-	printf("USER_NPROC=%d\n", u_limit.rlim_cur);
+	printf("USER_NPROC=%d\n", (int)u_limit.rlim_cur);
 #else
 	printf("USER_NPROC unsupported\n");
 #endif
 #ifdef RLIMIT_STACK
         (void) getrlimit(RLIMIT_STACK, &u_limit);
-        printf("USER_STACK=%d\n", u_limit.rlim_cur);
+        printf("USER_STACK=%d\n", (int)u_limit.rlim_cur);
 #else
         printf("USER_STACK unsupported\n");
 #endif
diff --git a/testsuite/expect/test19.5 b/testsuite/expect/test19.5
index 6fae61fbff4166feabb2fa577ecdf5a7a034b093..891f84aae59e11dca739b956650d14f58be43d8e 100755
--- a/testsuite/expect/test19.5
+++ b/testsuite/expect/test19.5
@@ -192,6 +192,13 @@ if {[wait_for_file $file_out_time] != 0} {
 			set run_time $expect_out(1,string)
 			exp_continue
 		}
+		-re "CG *0:($number)" {
+			send_user "\nFAILURE: job unexpected found in completing state.\n"
+			send_user "  This may be a sign of node failure and job requeue.\n"
+			set exit_code 1
+			set run_time $expect_out(1,string)
+			exp_continue
+		}
 		eof {
 			wait
 		}
diff --git a/testsuite/expect/test7.3.io.c b/testsuite/expect/test7.3.io.c
index 46ca90074f11f9bcc911d27370553449e0d9066a..cc33dd8b7f9211937edb274445c95e19c57ef8d2 100644
--- a/testsuite/expect/test7.3.io.c
+++ b/testsuite/expect/test7.3.io.c
@@ -38,15 +38,15 @@
 int main(int argc, char **argv)
 {
 	char buf1[128], buf2[128], *tmp;
-	int size, j, procid = -1;
+	int size, j, procid = -1, rc = 0;
 
 	tmp = getenv("SLURM_PROCID");
 	if (tmp)
 		procid = atoi(tmp);
 	sprintf(buf1, "task %d write to stdout:", procid);
-	write(STDOUT_FILENO, buf1, strlen(buf1));
+	rc = write(STDOUT_FILENO, buf1, strlen(buf1));
 	sprintf(buf1, "task %d write to stderr:", procid);
-	write(STDOUT_FILENO, buf1, strlen(buf1));
+	rc = write(STDOUT_FILENO, buf1, strlen(buf1));
 	while  ((size = read(STDIN_FILENO, buf1, sizeof(buf1))) != 0) {
 		if (size > 0) {
 			int offset;
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
 				buf2[offset+j] = buf1[j];
 			buf2[offset+j] = ':';
 			buf2[offset+j+1] = '\0';
-			write(STDOUT_FILENO, buf2, strlen(buf2));
+			rc = write(STDOUT_FILENO, buf2, strlen(buf2));
 			break;
 		} else {
 			if ((errno == EINTR) || (errno == EAGAIN)) {
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
 				continue;
 			}
 			sprintf(buf1, "io read errno:%d:", errno);
-			write(STDOUT_FILENO, buf1, strlen(buf1));
+			rc = write(STDOUT_FILENO, buf1, strlen(buf1));
 			break;
 		}
 	}