Index: Singular/LIB/primdec.lib
===================================================================
--- Singular/LIB/primdec.lib	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ Singular/LIB/primdec.lib	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -6460,8 +6460,8 @@
   list qr = simplifyIdeal(i);
   map phi = @P, qr[2];  // map from the same ring, to simplify the ideal
-  
-  
+
+
   option(redSB);
-  i = groebner(qr[1]);  // We use the transformed variables, and we 
+  i = groebner(qr[1]);  // We use the transformed variables, and we
                         // will use map phi to go back to the original
                         // variables
@@ -6538,5 +6538,5 @@
     }
   }
-    
+
   rad=interred(phi(rad));  // Eliminate redundant polynomials
   setring(P0);
Index: Singular/LIB/puiseuxexpansions.lib
===================================================================
--- Singular/LIB/puiseuxexpansions.lib	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ Singular/LIB/puiseuxexpansions.lib	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -479,5 +479,5 @@
         @c = puiseuxStep(fTemp, slN, 1);
         fc = factorize(@c);
-        
+
         for(j = 2; j <= size(fc[1]); j++)
         {
@@ -505,5 +505,5 @@
               {
                 sizeErg = size(erg);
-              } else 
+              } else
               {
                 sizeErg = 1;
@@ -538,5 +538,5 @@
                     {
                       cs[size(cs) + 1] = list((csT[k][1] + c1)*(var(1)^(csT[k][2]*slN)), csT[k][2]*slD);
-                    } else 
+                    } else
                     {
                       cs[size(cs) + 1] = list(csT[k][1] + c1, csT[k][2]*slD);
@@ -547,5 +547,5 @@
                     // NEW CODING FOR CONJUGATED EXPANSIONS
                     cs[size(cs)][6] = insert(csT[k][6], cod);
-                    
+
                     if(newExt == 1)
                     {
@@ -565,5 +565,5 @@
                       }
                     }
-                  } else 
+                  } else
                   {
                     def RT = csT[k];
@@ -928,5 +928,5 @@
 
       fNew1 = subst(f, var(1), var(1)^slD);
-      
+
       for(ii = 2; ii <= size(fJe[1]); ii++)
       {
@@ -948,5 +948,5 @@
         @c = puiseuxStep(fTemp, slN, 1);
         fc = factorize(@c);
-        
+
         // Stopping criterium
         stop = 0;
@@ -957,5 +957,5 @@
             stop = 1;
           }
-        } else 
+        } else
         {
           if(slN >= slD * maxDeg)
@@ -968,5 +968,5 @@
         {
           //minP = fc[1][j];
-          
+
           // The minpoly of Y^5-1 is Y-1 and the minpoly of Y^5-2 is Y^5-2.
           minPBefore = subst(fJe[1][ii],var(1),1);
@@ -981,5 +981,5 @@
             {
               sizeErg = size(erg);
-            } else 
+            } else
             {
               sizeErg = 1;
@@ -1014,5 +1014,5 @@
                   {
                     cs[size(cs) + 1] = list((csT[k][1] + c1)*(var(1)^(csT[k][2]*slN)), csT[k][2]*slD);
-                  } else 
+                  } else
                   {
                     cs[size(cs) + 1] = list(csT[k][1] + c1, csT[k][2]*slD);
@@ -1023,5 +1023,5 @@
                   // NEW CODING FOR CONJUGATED EXPANSIONS
                   cs[size(cs)][6] = insert(csT[k][6], cod);
-                  
+
                   if(newExt == 1)
                   {
@@ -1039,5 +1039,5 @@
                     }
                   }
-                } else 
+                } else
                 {
                   def RT = csT[k];
Index: Singular/extra.cc
===================================================================
--- Singular/extra.cc	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ Singular/extra.cc	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -4147,5 +4147,5 @@
     }
     else
-#endif    
+#endif
 /*==================== Error =================*/
       Werror( "(extended) system(\"%s\",...) %s", sys_cmd, feNotImplemented );
Index: Singular/fehelp.cc
===================================================================
--- Singular/fehelp.cc	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ Singular/fehelp.cc	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -1028,5 +1028,5 @@
   }
   Print("running `%s`\n",sys);
-  if (!FE_OPT_NO_SHELL_FLAG) 
+  if (!FE_OPT_NO_SHELL_FLAG)
   {
     int err=system(sys);
Index: Singular/iplib.cc
===================================================================
--- Singular/iplib.cc	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ Singular/iplib.cc	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -206,5 +206,6 @@
   }
 
-  fseek(fp, pi->data.s.proc_start, SEEK_SET);
+  int res=fseek(fp, pi->data.s.proc_start, SEEK_SET);
+  if (res==1) return NULL;
   if(part==0)
   { // load help string
@@ -220,8 +221,11 @@
     //    pi->data.s.proc_start, procbuflen);
     s = (char *)omAlloc(procbuflen+head+3);
-    myfread(s, head, 1, fp);
+    res=myfread(s, head, 1, fp);
+    if (res<=0) /* error*/ { omFree(s); return NULL; }
     s[head] = '\n';
-    fseek(fp, pi->data.s.help_start, SEEK_SET);
-    myfread(s+head+1, procbuflen, 1, fp);
+    int res=fseek(fp, pi->data.s.help_start, SEEK_SET);
+    if (res==-1) /*error*/ { omFree(s); return NULL; }
+    res=myfread(s+head+1, procbuflen, 1, fp);
+    if (res<=0) /* error*/ { omFree(s); return NULL; }
     fclose(fp);
     s[procbuflen+head+1] = '\n';
@@ -281,5 +285,9 @@
     // load example
     fseek(fp, pi->data.s.example_start, SEEK_SET);
-    /*char *dummy=*/ (void) fgets(buf, sizeof(buf), fp); // skip line with "example"
+    char* res=fgets(buf, sizeof(buf), fp); // skip line with "example"
+    if (res==NULL) /*error or eof*/
+    {
+      return omStrDup("");
+    }
     procbuflen = pi->data.s.proc_end - pi->data.s.example_start - strlen(buf);
     //Print("Example=%ld-%ld=%d\n", pi->data.s.proc_end,
Index: Singular/links/ssiLink.cc
===================================================================
--- Singular/links/ssiLink.cc	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ Singular/links/ssiLink.cc	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -1024,4 +1024,13 @@
       if (strcmp(mode,"fork")==0)
       {
+        int pc[2];
+        int cp[2];
+        int err1=pipe(pc);
+        int err2=pipe(cp);
+	if (err1 || err2)
+	{
+          Werror("pipe failed with %d\n",errno);
+          return TRUE;
+	}
         link_list n=(link_list)omAlloc(sizeof(link_struct));
         n->u=u;
@@ -1030,8 +1039,4 @@
         ssiToBeClosed=n;
 
-        int pc[2];
-        int cp[2];
-        pipe(pc);
-        pipe(cp);
         pid_t pid = fork();
         if (pid == -1 && errno == EAGAIN)   // RLIMIT_NPROC too low?
@@ -1257,5 +1262,13 @@
         omFree(cli_host);
         if (TEST_OPT_PROT) { Print("running >>%s<<\n",ssh_command); }
-        system(ssh_command);
+        int re=system(ssh_command);
+	if (re<0)
+	{
+          Werror("ERROR running `%s` (%d)",ssh_command,re);
+          l->data=NULL;
+          l->flags=0;
+          omFree(d);
+          return TRUE;
+	}
         omFree(ssh_command);
         omFree(ser_host);
Index: Singular/sdb.cc
===================================================================
--- Singular/sdb.cc	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ Singular/sdb.cc	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -144,6 +144,13 @@
     }
 
-    write(f,pi->data.s.body,strlen(pi->data.s.body));
+    size_t res=write(f,pi->data.s.body,strlen(pi->data.s.body));
     close(f);
+    if (res==-1)
+    {
+      PrintS("cannot write the procedure body\n");
+      si_unlink(filename);
+      omFree(filename);
+      return;
+    }
 
     int pid=fork();
@@ -164,5 +171,9 @@
         char *p=(char *)omAlloc(len);
         snprintf(p,len,"%s %s",editor,filename);
-        system(p);
+        int res=system(p);
+	if (res<0)
+	{
+          Print("cannot call `%s`\n",editor);
+	}
       }
       exit(0);
Index: libpolys/coeffs/flintcf_Qrat.cc
===================================================================
--- libpolys/coeffs/flintcf_Qrat.cc	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ libpolys/coeffs/flintcf_Qrat.cc	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -70,5 +70,5 @@
 }
 
-static void fmpq_rat_canonicalise(fmpq_rat_ptr a, const coeffs r)
+static void fmpq_rat_canonicalise(fmpq_rat_ptr a, const coeffs /*r*/)
 {
   fmpz_t n, d;
@@ -99,5 +99,4 @@
   if (c->type == n)
   {
-    const fmpq_ctx_ptr ctx = (fmpq_ctx_ptr) ((data_ptr)c->data)->ctx;
     const QaInfo *par=(QaInfo*)parameter;
     if (par->N != c->iNumberOfParameters) return FALSE;
@@ -630,5 +629,4 @@
   if (fmpq_mpoly_is_fmpq(x->den, ctx) && fmpq_mpoly_is_fmpq(x->num, ctx))
   {
-    long nl = 0;
     fmpq_t r;
     fmpq_init(r);
@@ -1184,5 +1182,5 @@
 }
 
-static number ExtGcd(number a, number b, number *s, number *t, const coeffs c)
+static number ExtGcd(number /*a*/, number /*b*/, number* /*s*/, number* /*t*/, const coeffs /*c*/)
 {
   WerrorS("not a Euclidean ring: ExtGcd");
@@ -1190,5 +1188,5 @@
 }
 
-static number Lcm(number a, number b, const coeffs c)
+static number Lcm(number /*a*/, number /*b*/, const coeffs /*c*/)
 {
   WerrorS("not yet: Lcm");
@@ -1196,5 +1194,5 @@
 }
 
-static number Q2Frac(number a, const coeffs src, const coeffs dst)
+static number Q2Frac(number a, const coeffs /*src*/, const coeffs dst)
 {
   number res;
@@ -1222,5 +1220,5 @@
 }
 
-static number Z2Frac(number a, const coeffs src, const coeffs dst)
+static number Z2Frac(number a, const coeffs /*src*/, const coeffs dst)
 {
   return InitMPZ((mpz_ptr)a,dst);
@@ -1508,67 +1506,64 @@
 {
   const fmpq_rat_ptr x = (fmpq_rat_ptr) c;
-  if ((x!=NULL)
-  && ((x->num==NULL)||(x->den==NULL)))
-  {
-    dReportError("NULL num., or den.\n");
-    return FALSE;
-  }
-  const fmpq_ctx_ptr ctx = (fmpq_ctx_ptr) ((data_ptr)cf->data)->ctx;
-  fmpq_mpoly_assert_canonical(x->num,ctx);
-  fmpq_mpoly_assert_canonical(x->den,ctx);
-  if (fmpq_mpoly_is_zero(x->den, ctx))
-  {
-    dReportError("den.==0\n");
-    return FALSE;
-  }
-  fmpz_t n, d;
-  fmpz_init(n);
-  fmpz_init(d);
-  fmpz_gcd(n, fmpq_numref(x->num->content), fmpq_numref(x->den->content));
-  fmpz_lcm(d, fmpq_denref(x->num->content), fmpq_denref(x->den->content));
-  if (!fmpz_is_one(d))
-  {
-     dReportError("canon needed (1)");
-     return TRUE;
-  }
-  if (!fmpz_is_one(n))
-  {
-     dReportError("canon needed (2)");
-     return TRUE;
-  }
-  fmpz_clear(n);
-  fmpz_clear(d);
-  #ifdef QA_DEBUG
-  poly pp=convFlintMPSingP(x->num,ctx,((data_ptr)cf->data)->C->extRing);
-  fraction f=(fraction)x->p;
-  if (f==NULL)
-  {
-    dReportError("x->p==NULL\n");
-    return FALSE;
-  }
-  else
-  {
-    if (!p_EqualPolys(pp,NUM(f),((data_ptr)cf->data)->C->extRing))
-    {
-      p_Write(pp,((data_ptr)cf->data)->C->extRing);
-      PrintS("num, p=");
-      p_Write(NUM(f),((data_ptr)cf->data)->C->extRing);
-      dReportError("num wrong.\n");
+  if (x!=NULL)
+  {
+    const fmpq_ctx_ptr ctx = (fmpq_ctx_ptr) ((data_ptr)cf->data)->ctx;
+    fmpq_mpoly_assert_canonical(x->num,ctx);
+    fmpq_mpoly_assert_canonical(x->den,ctx);
+    if (fmpq_mpoly_is_zero(x->den, ctx))
+    {
+      dReportError("den.==0\n");
       return FALSE;
     }
-    if (DEN(f)!=NULL)
-    {
-      pp=convFlintMPSingP(x->den,ctx,((data_ptr)cf->data)->C->extRing);
-      if (!p_EqualPolys(pp,DEN(f),((data_ptr)cf->data)->C->extRing))
+    fmpz_t n, d;
+    fmpz_init(n);
+    fmpz_init(d);
+    fmpz_gcd(n, fmpq_numref(x->num->content), fmpq_numref(x->den->content));
+    fmpz_lcm(d, fmpq_denref(x->num->content), fmpq_denref(x->den->content));
+    if (!fmpz_is_one(d))
+    {
+       dReportError("canon needed (1)");
+       return TRUE;
+    }
+    if (!fmpz_is_one(n))
+    {
+       dReportError("canon needed (2)");
+       return TRUE;
+    }
+    fmpz_clear(n);
+    fmpz_clear(d);
+    #ifdef QA_DEBUG
+    poly pp=convFlintMPSingP(x->num,ctx,((data_ptr)cf->data)->C->extRing);
+    fraction f=(fraction)x->p;
+    if (f==NULL)
+    {
+      dReportError("x->p==NULL\n");
+      return FALSE;
+    }
+    else
+    {
+      if (!p_EqualPolys(pp,NUM(f),((data_ptr)cf->data)->C->extRing))
       {
         p_Write(pp,((data_ptr)cf->data)->C->extRing);
-        PrintS("den, p=");
+        PrintS("num, p=");
         p_Write(NUM(f),((data_ptr)cf->data)->C->extRing);
-        dReportError("den wrong.\n");
+        dReportError("num wrong.\n");
         return FALSE;
       }
-    }
-  }
-  #endif
+      if (DEN(f)!=NULL)
+      {
+        pp=convFlintMPSingP(x->den,ctx,((data_ptr)cf->data)->C->extRing);
+        if (!p_EqualPolys(pp,DEN(f),((data_ptr)cf->data)->C->extRing))
+        {
+          p_Write(pp,((data_ptr)cf->data)->C->extRing);
+          PrintS("den, p=");
+          p_Write(NUM(f),((data_ptr)cf->data)->C->extRing);
+          dReportError("den wrong.\n");
+          return FALSE;
+        }
+      }
+    }
+    #endif
+  }
   return TRUE;
 }
Index: libpolys/coeffs/gnumpc.cc
===================================================================
--- libpolys/coeffs/gnumpc.cc	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ libpolys/coeffs/gnumpc.cc	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -603,5 +603,5 @@
     // cfSize  = ndSize;
 #ifdef LDEBUG
-  //n->cfDBTest  = ndDBTest; // not yet implemented: ngcDBTest
+  n->cfDBTest  = ngcDBTest; // not yet implemented: ngcDBTest
 #endif
 
Index: libpolys/coeffs/longrat.cc
===================================================================
--- libpolys/coeffs/longrat.cc	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ libpolys/coeffs/longrat.cc	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -1758,4 +1758,5 @@
     case 1:
             mpz_init_set(b->n,a->n);
+            /*no break*/
     case 3:
             mpz_init_set(b->z,a->z);
@@ -1774,4 +1775,5 @@
       case 1:
         mpz_clear((*a)->n);
+        /*no break*/
       case 3:
         mpz_clear((*a)->z);
Index: libpolys/coeffs/rmodulon.cc
===================================================================
--- libpolys/coeffs/rmodulon.cc	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ libpolys/coeffs/rmodulon.cc	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -72,5 +72,5 @@
   nrnCoeffName_buff=(char*)omAlloc(l);
   s= mpz_get_str (s, 10, r->modBase);
-  int ll;
+  int ll=0;
   if (nCoeff_is_Zn(r))
   {
Index: m4/ccluster-check.m4
===================================================================
--- m4/ccluster-check.m4	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ m4/ccluster-check.m4	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -46,5 +46,5 @@
 if test "x$HAVE_CCLUSTER" != "xyes"; then
   AC_MSG_RESULT(not found)
-fi  
+fi
 AM_CONDITIONAL(SING_HAVE_CCLUSTER, test "x$HAVE_CCLUSTER" = "xyes")
 ])
Index: m4/options.m4
===================================================================
--- m4/options.m4	(revision dff47b7996ab7bb15ce9bd372c7fc531a02308f7)
+++ m4/options.m4	(revision b8ad3a5727b2172b74c3463b20d9424109328f5d)
@@ -173,5 +173,5 @@
   AC_SUBST(RESOURCES_LIBS)
 
-  if test "x$htmldir" = "x\${docdir}"; then 
+  if test "x$htmldir" = "x\${docdir}"; then
     DEFAULT_HTMLDIR="--htmldir=$datarootdir/doc/singular"
   fi
