Index: /trunk/Ohana/src/elixir/src/RemoteOps.c
===================================================================
--- /trunk/Ohana/src/elixir/src/RemoteOps.c	(revision 27610)
+++ /trunk/Ohana/src/elixir/src/RemoteOps.c	(revision 27611)
@@ -20,5 +20,8 @@
   }
   sprintf (line, "kill -USR1 %d\n", pid);
-  write (wsock, line, strlen (line));
+  if (write (wsock, line, strlen (line)) != strlen(line)) {
+    fprintf (stderr, "error sending signal\n");
+    exit (1);
+  }
 
   for (i = 0; i < 100; i++) {
@@ -49,5 +52,8 @@
   }
   sprintf (line, "kill -TERM %d\n", pid);
-  write (wsock, line, strlen (line));
+  if (write (wsock, line, strlen (line)) != strlen(line)) {
+    fprintf (stderr, "error sending signal\n");
+    exit (1);
+  }
 
   for (i = 0; i < 100; i++) {
@@ -75,5 +81,8 @@
 
   sprintf (response, "%s.XXXXXX", msgfile);
-  mkstemp (response);
+  if (mkstemp (response) == -1) {
+    fprintf (stderr, "can't make temp file\n");
+    exit (1);
+  }
   sprintf (message, "STATUS %s", response);
   if (VERBOSE) fprintf (stderr, "sending message: %s\n", message);
@@ -86,5 +95,8 @@
   }
   sprintf (line, "kill -USR2 %d\n", pid);
-  write (wsock, line, strlen (line));
+  if (write (wsock, line, strlen (line)) != strlen(line)) {
+    fprintf (stderr, "error sending signal\n");
+    exit (1);
+  }
 
   /* wait (2 sec) for file to exist, then try to read it */
@@ -146,5 +158,8 @@
   /* send TERM signal */
   sprintf (line, "kill -TERM %d\n", pid);
-  write (wsock, line, strlen (line));
+  if (write (wsock, line, strlen (line)) != strlen(line)) {
+    fprintf (stderr, "error sending signal\n");
+    exit (1);
+  }
 
   /* wait for cleanup to finish */
@@ -159,5 +174,9 @@
   /* kill meanly */
   sprintf (line, "kill -KILL %d", pid);
-  write (wsock, line, strlen (line));
+  if (write (wsock, line, strlen (line)) != strlen(line)) {
+    fprintf (stderr, "error sending signal\n");
+    exit (1);
+  }
+
   unlink (pidfile);
 
@@ -165,5 +184,8 @@
  success:
   sprintf (line, "exit\n");
-  write (wsock, line, strlen(line));
+  if (write (wsock, line, strlen (line)) != strlen(line)) {
+    fprintf (stderr, "error sending signal\n");
+    exit (1);
+  }
   close (wsock);
   close (rsock);
@@ -174,4 +196,5 @@
 int LoadPID (char *file, pid_t *pid, char *username, char *machine) {
 
+  int t1, t2, t3;
   FILE *f;
 
@@ -181,7 +204,10 @@
   }
 
-  fscanf (f, "%*s %d", pid);
-  fscanf (f, "%*s %s", username);
-  fscanf (f, "%*s %s", machine);
+  t1 = fscanf (f, "%*s %d", pid);
+  t2 = fscanf (f, "%*s %s", username);
+  t3 = fscanf (f, "%*s %s", machine);
+  if ((t1 != 1) || (t2 != 2) || (t3 != 1)) {
+    fprintf (stderr, "error reading pid info\n");
+  }
   fclose (f);
 
Index: /trunk/Ohana/src/gastro/src/gcenter.c
===================================================================
--- /trunk/Ohana/src/gastro/src/gcenter.c	(revision 27610)
+++ /trunk/Ohana/src/gastro/src/gcenter.c	(revision 27611)
@@ -79,5 +79,7 @@
     fprintf (stderr, "plotting %d points\n", Nvect);
     fprintf (stderr, "type return to continue");
-    fscanf (stdin, "%c", &c);
+    if (fscanf (stdin, "%c", &c) != 1) {
+      fprintf (stderr, "\n");
+    }
     Nvect = 0;
   }
@@ -166,5 +168,7 @@
       fprintf (stderr, "plotting %d points\n", Nvect);
       fprintf (stderr, "type return to continue");
-      fscanf (stdin, "%c", &c);
+      if (fscanf (stdin, "%c", &c) != 1) {
+	fprintf (stderr, "\n");
+      }
       Nvect = 0;
     }
Index: /trunk/Ohana/src/gastro/src/getusno.c
===================================================================
--- /trunk/Ohana/src/gastro/src/getusno.c	(revision 27610)
+++ /trunk/Ohana/src/gastro/src/getusno.c	(revision 27611)
@@ -58,5 +58,5 @@
       fprintf (stderr, "can't open file %s, is cdrom %d in drive?\n", filename, disk);
       fprintf (stderr, "press return when ready to continue: ");
-      fscanf (stdin, "%c", &c);
+      if (fscanf (stdin, "%c", &c) != 1) fprintf (stderr, "\n");
       fprintf (stderr, "trying again...\n");
       f = fopen (filename, "r");
Index: /trunk/Ohana/src/gastro/src/gfit.c
===================================================================
--- /trunk/Ohana/src/gastro/src/gfit.c	(revision 27610)
+++ /trunk/Ohana/src/gastro/src/gfit.c	(revision 27611)
@@ -242,5 +242,5 @@
       fprintf (stderr, "plotting %d points\n", Nvect);
       fprintf (stderr, "type return to continue");
-      fscanf (stdin, "%c", &c);
+      if (fscanf (stdin, "%c", &c) != 1) fprintf (stderr, "\n");
       Nvect = 0;
     }
Index: /trunk/Ohana/src/gastro2/src/plots.c
===================================================================
--- /trunk/Ohana/src/gastro2/src/plots.c	(revision 27610)
+++ /trunk/Ohana/src/gastro2/src/plots.c	(revision 27611)
@@ -61,5 +61,5 @@
   DonePlotting (&gv, 2);
   fprintf (stderr, "type return to continue");
-  fscanf (stdin, "%c", &c);
+  if (fscanf (stdin, "%c", &c) != 1) fprintf (stderr, "\n");
   free (xv);
   free (yv);
@@ -117,5 +117,5 @@
   DonePlotting (&graphdata, Xg[version]);
   fprintf (stderr, "type return to continue");
-  fscanf (stdin, "%c", &c);
+  if (fscanf (stdin, "%c", &c) != 1) fprintf (stderr, "\n");
 }
 
@@ -161,5 +161,5 @@
   DonePlotting (&graphdata, 0);
   fprintf (stderr, "type return to continue");
-  fscanf (stdin, "%c", &c);
+  if (fscanf (stdin, "%c", &c) != 1) fprintf (stderr, "\n");
 }
 
@@ -245,5 +245,5 @@
   DonePlotting (&gf, 1);
   fprintf (stderr, "type return to continue");
-  fscanf (stdin, "%c", &c);
+  if (fscanf (stdin, "%c", &c) != 1) fprintf (stderr, "\n");
 }
 
@@ -261,5 +261,5 @@
   PlotVector (n, y, 1, 1);
   fprintf (stderr, "type return to continue");
-  fscanf (stdin, "%c", &c);
+  if (fscanf (stdin, "%c", &c) != 1) fprintf (stderr, "\n");
 }  
 
@@ -336,5 +336,5 @@
   DonePlotting (&graphdata, 0);
   fprintf (stderr, "type return to continue");
-  fscanf (stdin, "%c", &c);
+  if (fscanf (stdin, "%c", &c) != 1) fprintf (stderr, "\n");
 
 }
Index: /trunk/Ohana/src/imregister/imreg/ConfigPID.c
===================================================================
--- /trunk/Ohana/src/imregister/imreg/ConfigPID.c	(revision 27610)
+++ /trunk/Ohana/src/imregister/imreg/ConfigPID.c	(revision 27611)
@@ -65,4 +65,5 @@
 int LoadPID (char *file, pid_t *pid, char *username, char *machine) {
 
+  int t1, t2, t3;
   FILE *f;
 
@@ -72,7 +73,10 @@
   }
 
-  fscanf (f, "%*s %d", pid);
-  fscanf (f, "%*s %s", username);
-  fscanf (f, "%*s %s", machine);
+  t1 = fscanf (f, "%*s %d", pid);
+  t2 = fscanf (f, "%*s %s", username);
+  t3 = fscanf (f, "%*s %s", machine);
+  if ((t1 != 1) || (t2 != 2) || (t3 != 1)) {
+    fprintf (stderr, "error reading pid info\n");
+  }
   fclose (f);
 
Index: /trunk/Ohana/src/imregister/imreg/SetSignals.c
===================================================================
--- /trunk/Ohana/src/imregister/imreg/SetSignals.c	(revision 27610)
+++ /trunk/Ohana/src/imregister/imreg/SetSignals.c	(revision 27611)
@@ -104,5 +104,8 @@
   }
   sprintf (line, "kill -TERM %d\n", pid);
-  write (wsock, line, strlen (line));
+  if (write (wsock, line, strlen (line)) != strlen(line)) {
+    fprintf (stderr, "error sending signal\n");
+    exit (1);
+  }
 
   for (i = 0; i < 300; i++) {
Index: /trunk/Ohana/src/imregister/imreg/imregclient.c
===================================================================
--- /trunk/Ohana/src/imregister/imreg/imregclient.c	(revision 27610)
+++ /trunk/Ohana/src/imregister/imreg/imregclient.c	(revision 27611)
@@ -22,5 +22,7 @@
       exit (1);
     }
-    fscanf (f, "%f %f", &image[0].sky, &image[0].bias);
+    if (fscanf (f, "%f %f", &image[0].sky, &image[0].bias) != 2) {
+      fprintf (stderr, "error reading stats\n");
+    }
     fclose (f);
     image[0].fwhm = get_fwhm (datfile);
Index: /trunk/Ohana/src/imregister/imreg/rconnect.c
===================================================================
--- /trunk/Ohana/src/imregister/imreg/rconnect.c	(revision 27610)
+++ /trunk/Ohana/src/imregister/imreg/rconnect.c	(revision 27611)
@@ -87,5 +87,11 @@
      without setting onintr */
   sprintf (buffer, "onintr\n");
-  write (*wsock, buffer, strlen(buffer));
+  if (write (*wsock, buffer, strlen (buffer)) != strlen(buffer)) {
+    fprintf (stderr, "error sending signal\n");
+    close (*wsock);
+    close (*rsock);
+    return (FALSE);
+  }
+
   if ((status == -1) && (errno == EPIPE)) {
     fprintf (stderr, "socket closed unexpectedly\n");
Index: /trunk/Ohana/src/imregister/src/imstatreg.c
===================================================================
--- /trunk/Ohana/src/imregister/src/imstatreg.c	(revision 27610)
+++ /trunk/Ohana/src/imregister/src/imstatreg.c	(revision 27611)
@@ -70,5 +70,8 @@
 
     /* delete, unlock existing database */
-    truncate (TempDB, 0);
+    if (truncate (TempDB, 0)) {
+      fprintf (stderr, "error truncating temp db\n");
+      exit (1);
+    }
     gfits_db_close (&temp_db);
     fprintf (stderr, "temporary database closed\n");
Index: /trunk/Ohana/src/nightd/src/GetStatus.c
===================================================================
--- /trunk/Ohana/src/nightd/src/GetStatus.c	(revision 27610)
+++ /trunk/Ohana/src/nightd/src/GetStatus.c	(revision 27611)
@@ -33,5 +33,7 @@
 
   sprintf (line, "rsh %s kill -USR1 %d", machine, pid);
-  system (line);
+  if (system (line) == -1) {
+    fprintf (stderr, "failed to send signal\n");
+  }
   exit (0);
 
@@ -50,5 +52,7 @@
 
   sprintf (line, "rsh %s kill -TERM %d", machine, pid);
-  system (line);
+  if (system (line) == -1) {
+    fprintf (stderr, "failed to send signal\n");
+  }
   exit (0);
 
Index: /trunk/Ohana/src/nightd/src/misc.c
===================================================================
--- /trunk/Ohana/src/nightd/src/misc.c	(revision 27610)
+++ /trunk/Ohana/src/nightd/src/misc.c	(revision 27611)
@@ -11,4 +11,5 @@
 int SetPID (pid_t *Xpid, char *Xuser, char *Xmachine) {
   
+  int t1, t2, t3;
   pid_t pid;
   char *username, machine[256];
@@ -43,7 +44,10 @@
   }
 
-  fscanf (f, "%*s %d", Xpid);
-  fscanf (f, "%*s %s", Xuser);
-  fscanf (f, "%*s %s", Xmachine);
+  t1 = fscanf (f, "%*s %d", Xpid);
+  t2 = fscanf (f, "%*s %s", Xuser);
+  t3 = fscanf (f, "%*s %s", Xmachine);
+  if ((t1 != 1) || (t2 != 2) || (t3 != 1)) {
+    fprintf (stderr, "error reading pid info\n");
+  }
   fclose (f);
   return (FALSE);
@@ -125,5 +129,5 @@
 
   eof = 0x04;
-  write (wfd[1], &eof, 1);
+  if (write (wfd[1], &eof, 1) != 1) fprintf (stderr, "!\n");
   close (wfd[1]);
  
Index: /trunk/Ohana/src/opihi/cmd.astro/flux.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/flux.c	(revision 27610)
+++ /trunk/Ohana/src/opihi/cmd.astro/flux.c	(revision 27611)
@@ -29,5 +29,9 @@
   ymax = 0;
   for (i = 0; i < 4; i++) {
-    fscanf (f, "%lf %lf", &x[i], &y[i]);
+    if (fscanf (f, "%lf %lf", &x[i], &y[i]) != 2) {
+      fprintf (stderr, "error reading coordinates from %s\n", argv[2]);
+      fclose (f);
+      return (FALSE);
+    }
     xmin = MAX (0, MIN (xmin, x[i] - 1));
     ymin = MAX (0, MIN (ymin, y[i] - 1));
Index: /trunk/Ohana/src/opihi/cmd.basic/help.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.basic/help.c	(revision 27610)
+++ /trunk/Ohana/src/opihi/cmd.basic/help.c	(revision 27611)
@@ -15,5 +15,8 @@
   if (argc == 1) {
     sprintf (buff, "ls %s", helpdir);
-    system (buff);
+    if (system (buff) == -1) {
+      fprintf (stderr, "help directory unavailable\n");
+      return (FALSE);
+    }
     return (TRUE);
   }
Index: /trunk/Ohana/src/opihi/cmd.basic/list_help.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.basic/list_help.c	(revision 27610)
+++ /trunk/Ohana/src/opihi/cmd.basic/list_help.c	(revision 27611)
@@ -18,5 +18,7 @@
     fclose (f);
     sprintf (line, "more %s", filename);
-    system (line);
+    if (system (line) == -1) {
+      fprintf (stderr, "help list unavailable\n");
+    }
   }
   unlink (filename);
Index: /trunk/Ohana/src/opihi/cmd.data/queuedrop.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/queuedrop.c	(revision 27610)
+++ /trunk/Ohana/src/opihi/cmd.data/queuedrop.c	(revision 27611)
@@ -4,8 +4,8 @@
   
   int N;
-  char *Key;
-  char *line;
-  char *Value;
-  Queue *queue;
+  char *Key = NULL;
+  char *line = NULL;
+  Queue *queue = NULL;
+  char *Value = NULL;
 
   Key = NULL;
Index: /trunk/Ohana/src/opihi/dvo/elixir.c
===================================================================
--- /trunk/Ohana/src/opihi/dvo/elixir.c	(revision 27610)
+++ /trunk/Ohana/src/opihi/dvo/elixir.c	(revision 27611)
@@ -46,5 +46,8 @@
 
   sprintf (msgfile, "%s/EMsg.XXXXXX", fifodir);
-  mkstemp (msgfile);
+  if (mkstemp (msgfile) == -1) {
+    gprint (GP_ERR, "can't create fifo\n");
+    return (FALSE);
+  }
   sprintf (message, "%s %s", cmd, msgfile);
   unlink (msgfile);
Index: /trunk/Ohana/src/opihi/lib.shell/interrupt.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/interrupt.c	(revision 27610)
+++ /trunk/Ohana/src/opihi/lib.shell/interrupt.c	(revision 27611)
@@ -27,5 +27,5 @@
   while (1) {
     gprint (GP_ERR, "operation halted, continue? (y/n) ");
-    fscanf (stdin, "%s", string);
+    if (fscanf (stdin, "%s", string) != 1) fprintf (stderr, "what?\n");
     
     if ((string[0] == 'y') || (string[0] == 'Y')) {
Index: /trunk/Ohana/src/relphot/src/plotstuff.c
===================================================================
--- /trunk/Ohana/src/relphot/src/plotstuff.c	(revision 27610)
+++ /trunk/Ohana/src/relphot/src/plotstuff.c	(revision 27611)
@@ -149,5 +149,5 @@
   if (PLOTDELAY > 500000) {
     fprintf (stdout, "press return\n"); 
-    fscanf (stdin, "%*c");
+    if (fscanf (stdin, "%*c") != 1) fprintf (stderr, "\n");
   } else {
     usleep (PLOTDELAY);
