Index: trunk/src/sh_sig.c
===================================================================
--- trunk/src/sh_sig.c	(revision 579)
+++ trunk/src/sh_sig.c	(revision 592)
@@ -645,5 +645,6 @@
   int    flag_sig  = S_FALSE;
   SL_TICKET fdTmp  = (-1);
-  SL_TICKET open_tmp (void);
+  SL_TICKET open_tmp  (void);
+  int       close_tmp ( SL_TICKET);
 
   /* extract the data and copy to temporary file
@@ -660,6 +661,7 @@
 
   fin_cp = fdopen(dup(get_the_fd(fd)), "rb");
+  if (!fin_cp) { close_tmp(fdTmp); return -1; }
   buf = SH_ALLOC(fgets_buf_size);
-
+  
   while (NULL != fgets(buf, fgets_buf_size, fin_cp))
     {
@@ -720,4 +722,6 @@
   fin_cp = fdopen(dup(get_the_fd(fdTmp)), "rb");
   FILE * fout = fopen("xxx.out", "w+");
+  if (!fout) { close_tmp(fdTmp); return -1; }
+  if (!fin_cp) { close_tmp(fdTmp); fclose(fout); return -1; }
   while (NULL != fgets(buf, fgets_buf_size, fin_cp))
     {
@@ -1598,6 +1602,7 @@
   int    flag_nohead = S_FALSE;
   SL_TICKET fdTmp = (-1);
-  SL_TICKET open_tmp (void);
-
+  SL_TICKET open_tmp  (void);
+  int       close_tmp ( SL_TICKET);
+  
   /* extract the data and copy to temporary file
    */
@@ -1613,6 +1618,7 @@
 
   fin_cp = fdopen(dup(get_the_fd(fd)), "rb");
+  if (!fin_cp) { close_tmp(fdTmp); return -1; }
   buf = SH_ALLOC(fgets_buf_size);
-
+  
   while (NULL != fgets(buf, fgets_buf_size, fin_cp))
     {
