diff --git a/src/common/log.c b/src/common/log.c
index 2727deab372212da29bd32fbabe85aa47e8f61f6..336a6a11f84d7820b3bc6848ba54beffd07ffbe8 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -1,5 +1,6 @@
 /*****************************************************************************\
- *  loc.c - slurm logging facilities
+ *  log.c - slurm logging facilities
+ *  $Id$
  *****************************************************************************
  *  Copyright (C) 2002 The Regents of the University of California.
  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
@@ -436,6 +437,23 @@ static void log_msg(log_level_t level, const char *fmt, va_list args)
 	xfree(buf);
 }
 
+/* LLNL Software development Toolbox (LSD-Tools)
+ * fatal() and nomem() functions
+ */
+void
+lsd_fatal_error(char *file, int line, char *msg)
+{
+	fatal("%s:%d %s: %m", file, line, msg);
+}
+
+void *
+lsd_nomem_error(char *file, int line, char *msg)
+{
+	error("%s:%d %s: %m", file, line, msg);
+	slurm_seterrno(ENOMEM);
+	return NULL;
+}
+
 /*
  * attempt to log message and abort()
  */
@@ -446,9 +464,9 @@ void fatal(const char *fmt, ...)
 	va_start(ap, fmt);
 	log_msg(LOG_LEVEL_FATAL, fmt, ap);
 	va_end(ap);
+	fatal_cleanup();
 
 #ifndef  NDEBUG
-	fatal_cleanup();
 	abort();
 #endif
 }
@@ -602,9 +620,8 @@ fatal_remove_cleanup_job(void (*proc) (void *context), void *context)
 		}
 	}
 	slurm_mutex_unlock(&fatal_lock);
-	fatal(
-	    "fatal_remove_cleanup_job: no such cleanup function: 0x%lx 0x%lx",
-	    (u_long) proc, (u_long) context);
+	fatal("fatal_remove_cleanup_job: no such cleanup function: "
+	      "0x%lx 0x%lx", (u_long) proc, (u_long) context);
 }
 
 /* Execute cleanup functions, first thread-specific then those for the 
diff --git a/src/common/macros.h b/src/common/macros.h
index 18f2d711e07317d1f1fe6a962baec53d2a9dbbfa..78122fcafc21b68484c7bf98f27ae271392dc70e 100644
--- a/src/common/macros.h
+++ b/src/common/macros.h
@@ -42,6 +42,7 @@
 typedef enum {false, true} bool;
 #endif /* !HAVE_STDBOOL_H */
 
+#include <errno.h>              /* for errno   */
 #include "src/common/log.h"	/* for error() */
 
 #ifndef FALSE
@@ -56,23 +57,23 @@ typedef enum {false, true} bool;
 #define MAX(a,b) ((a) > (b) ? (a) : (b))	
 #endif
 
-#  define UINT64_SWAP_LE_BE(val)      ((uint64_t) (                        \
-        (((uint64_t) (val) &                                               \
-	  (uint64_t) (0x00000000000000ffU)) << 56) |                       \
-	(((uint64_t) (val) &                                               \
-	  (uint64_t) (0x000000000000ff00U)) << 40) |                       \
-	(((uint64_t) (val) &                                               \
-	  (uint64_t) (0x0000000000ff0000U)) << 24) |                       \
-	(((uint64_t) (val) &                                               \
-	  (uint64_t) (0x00000000ff000000U)) <<  8) |                       \
-	(((uint64_t) (val) &                                               \
-	  (uint64_t) (0x000000ff00000000U)) >>  8) |                       \
-	(((uint64_t) (val) &                                               \
-	  (uint64_t) (0x0000ff0000000000U)) >> 24) |                       \
-	(((uint64_t) (val) &                                               \
-	  (uint64_t) (0x00ff000000000000U)) >> 40) |                       \
-	(((uint64_t) (val) &                                               \
-	  (uint64_t) (0xff00000000000000U)) >> 56)))
+#  define UINT64_SWAP_LE_BE(val)      ((uint64_t) (                           \
+        (((uint64_t) (val) &                                                  \
+          (uint64_t) (0x00000000000000ffU)) << 56) |                          \
+        (((uint64_t) (val) &                                                  \
+          (uint64_t) (0x000000000000ff00U)) << 40) |                          \
+        (((uint64_t) (val) &                                                  \
+          (uint64_t) (0x0000000000ff0000U)) << 24) |                          \
+        (((uint64_t) (val) &                                                  \
+          (uint64_t) (0x00000000ff000000U)) <<  8) |                          \
+        (((uint64_t) (val) &                                                  \
+          (uint64_t) (0x000000ff00000000U)) >>  8) |                          \
+        (((uint64_t) (val) &                                                  \
+          (uint64_t) (0x0000ff0000000000U)) >> 24) |                          \
+        (((uint64_t) (val) &                                                  \
+          (uint64_t) (0x00ff000000000000U)) >> 40) |                          \
+        (((uint64_t) (val) &                                                  \
+          (uint64_t) (0xff00000000000000U)) >> 56)))
 
 #if SLURM_BIGENDIAN
 # define HTON_int64(x)	  ((int64_t)  (x))
@@ -130,7 +131,7 @@ typedef enum {false, true} bool;
  */
 #if !(defined (_STMT_START) && defined (_STMT_END))
 #  if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
-#    define _STMT_START        ((void)
+#    define _STMT_START        (void)(
 #    define _STMT_END          )
 #  else
 #    if (defined (sun) || defined (__sun__))
@@ -145,33 +146,45 @@ typedef enum {false, true} bool;
 
 #ifdef WITH_PTHREADS
 
-#  define slurm_mutex_init(mutex)                                              \
-     do {                                                                      \
-         if ((errno = pthread_mutex_init(mutex, NULL)) != 0)                   \
-             error("%s:%d %s: pthread_mutex_init(): %m", 		       \
-	           __FILE__, __LINE__, __CURRENT_FUNC__);            	       \
-     } while (0)
-
-#  define slurm_mutex_destroy(mutex)                                           \
-     do {                                                                      \
-         if ((errno = pthread_mutex_destroy(mutex)) != 0)                      \
-             error("%s:%d %s: pthread_mutex_destroy(): %m", 		       \
-	           __FILE__, __LINE__, __CURRENT_FUNC__);            	       \
-     } while (0)
-
-#  define slurm_mutex_lock(mutex)                                              \
-     do {                                                                      \
-         if ((errno = pthread_mutex_lock(mutex)) != 0)	                       \
-             error("%s:%d %s: pthread_mutex_lock(): %m", 		       \
-	           __FILE__, __LINE__, __CURRENT_FUNC__);            	       \
-     } while (0)
-
-#  define slurm_mutex_unlock(mutex)                                            \
-     do {                                                                      \
-         if ((errno = pthread_mutex_unlock(mutex)) != 0)                       \
-             error("%s:%d %s: pthread_mutex_unlock(): %m", 		       \
-	           __FILE__, __LINE__, __CURRENT_FUNC__);            	       \
-     } while (0)
+#  define slurm_mutex_init(mutex)                                             \
+     _STMT_START {                                                            \
+         int err = pthread_mutex_init(mutex, NULL);                           \
+         if (err) {                                                           \
+             errno = err;                                                     \
+             error("%s:%d %s: pthread_mutex_init(): %m",                      \
+                   __FILE__, __LINE__, __CURRENT_FUNC__);                     \
+         }                                                                    \
+     } _STMT_END
+
+#  define slurm_mutex_destroy(mutex)                                          \
+     _STMT_START {                                                            \
+         int err = pthread_mutex_destroy(mutex);                              \
+         if (err) {                                                           \
+             errno = err;                                                     \
+             error("%s:%d %s: pthread_mutex_destroy(): %m",                   \
+                   __FILE__, __LINE__, __CURRENT_FUNC__);                     \
+         }                                                                    \
+     } _STMT_END
+
+#  define slurm_mutex_lock(mutex)                                             \
+     _STMT_START {                                                            \
+         int err = pthread_mutex_lock(mutex);                                 \
+         if (err) {                                                           \
+             errno = err;                                                     \
+             error("%s:%d %s: pthread_mutex_lock(): %m",                      \
+                   __FILE__, __LINE__, __CURRENT_FUNC__);                     \
+         }                                                                    \
+     } _STMT_END
+
+#  define slurm_mutex_unlock(mutex)                                           \
+     _STMT_START {                                                            \
+         int err = pthread_mutex_unlock(mutex);                               \
+         if (err) {                                                           \
+             errno = err;                                                     \
+             error("%s:%d %s: pthread_mutex_unlock(): %m",                    \
+                   __FILE__, __LINE__, __CURRENT_FUNC__);                     \
+         }                                                                    \
+     } _STMT_END
 
 #else /* !WITH_PTHREADS */
 
@@ -182,5 +195,4 @@ typedef enum {false, true} bool;
 
 #endif /* WITH_PTHREADS */
 
-
 #endif /* !_MACROS_H */
diff --git a/src/common/slurm_errno.c b/src/common/slurm_errno.c
index 5ae0b235460a787ded10defa9e8261a4ec3c1210..e77bed6f12ca2a598711d6553c3182ed058b605d 100644
--- a/src/common/slurm_errno.c
+++ b/src/common/slurm_errno.c
@@ -231,9 +231,9 @@ static slurm_errtab_t slurm_errtab[] = {
 
 	/* slurmd errors in user batch job */
 	{ ESCRIPT_CHDIR_FAILED,
-	  "Script unable to change directory to work directory"	},
+	  "unable to change directory to work directory"	},
 	{ ESCRIPT_OPEN_OUTPUT_FAILED,
-	  "Script cound not open output file"			},
+	  "cound not open output file"			        },
 	{ ESCRIPT_NON_ZERO_RETURN,
 	  "Script terminated with non-zero exit code"		},
 
diff --git a/src/common/slurm_protocol_socket_implementation.c b/src/common/slurm_protocol_socket_implementation.c
index 96d5936b0b9717efb7517f2e21bf6c3f5f0e0d6b..75279e2b8e09855c577800287e8b074ed37cce49 100644
--- a/src/common/slurm_protocol_socket_implementation.c
+++ b/src/common/slurm_protocol_socket_implementation.c
@@ -498,18 +498,10 @@ slurm_fd _slurm_listen_stream ( slurm_addr * slurm_address )
 	
 }
 
-slurm_fd _slurm_accept_stream ( slurm_fd open_fd , slurm_addr * slurm_address )
+slurm_fd _slurm_accept_stream(slurm_fd fd, slurm_addr *addr)
 {
-	size_t addr_len = sizeof ( slurm_addr ) ;
-	slurm_fd connection_fd ;
-	if ( ( connection_fd = _slurm_accept ( open_fd , 
-				( struct sockaddr * ) slurm_address , 
-				& addr_len ) ) == SLURM_SOCKET_ERROR )
-	{
-		debug ( "Error accepting slurm stream socket: %m" ) ;
-	}
-	return connection_fd ;
-
+	size_t len = sizeof(slurm_addr);
+	return _slurm_accept(fd, (struct sockaddr *)addr, &len);
 }
 
 slurm_fd _slurm_open_stream ( slurm_addr * slurm_address )
diff --git a/src/common/xassert.h b/src/common/xassert.h
index a7b50cbf2821733b44cffc6418295a3817baf977..161ce42e6b0e200a1571b611b14227d03242b289 100644
--- a/src/common/xassert.h
+++ b/src/common/xassert.h
@@ -17,13 +17,13 @@
 
 #ifdef NDEBUG
 
-#  define assert(expr)	((void)0)
+#  define xassert(expr)	((void)0)
 
 #else /* !NDEBUG */
 
 #  define xassert(__ex)  _STMT_START { \
      (__ex) ? ((void)0) : \
-     __xassert_failed(__STRING(__ex), __FILE__,  __LINE__, __CURRENT_FUNC__) \
+     __xassert_failed(__STRING(__ex), __FILE__,  __LINE__, __CURRENT_FUNC__);\
      } _STMT_END 
 
 /*  This prints the assertion failed message to the slurm log facility
diff --git a/src/common/xmalloc.c b/src/common/xmalloc.c
index 18174c36b4e3cd9d8bc6f5429d7d97423319953e..4d8e52099385cc52577a4909d7d8cd5ac2ebd113 100644
--- a/src/common/xmalloc.c
+++ b/src/common/xmalloc.c
@@ -57,10 +57,10 @@ static void malloc_assert_failed(char *, const char *, int,
 #if NDEBUG
 #  define xmalloc_assert  ((void)0)
 #else
-#  define xmalloc_assert(expr)  _STMT_START {  			    \
-          (expr) ? ((void)(0)) :                                    \
-          malloc_assert_failed(__STRING(expr), file, line, func,    \
-                               __CURRENT_FUNC__)                    \
+#  define xmalloc_assert(expr)  _STMT_START {                                 \
+          (expr) ? ((void)(0)) :                                              \
+          malloc_assert_failed(__STRING(expr), file, line, func,              \
+                               __CURRENT_FUNC__);                             \
           } _STMT_END
 #endif /* NDEBUG */